Sponsored Content
Top Forums UNIX for Dummies Questions & Answers Use variable in object library (ar) Post 302346118 by justinpark01 on Friday 21st of August 2009 04:56:40 AM
Old 08-21-2009
Use variable in object library (ar)

I am trying to use a library, lets say libexample.a, and I want to use a variable within the object files that were archived. For example, my new code (which is linked to the library, don't worry about that) wants to access an integer from the original source.

When I use the nm command on libexample.a I see a bunch of stuff, including:
000006ec b var$39.0

I want use that variable. I know its original name and try to call it with my new code but it fails. I have no problem accessing the functions within libexample.a, I just want to use that integer. Or maybe it just isn't possible?

Thanks in advance for any help.

Last edited by justinpark01; 08-21-2009 at 09:00 AM..
 

9 More Discussions You Might Find Interesting

1. AIX

Shared Object library problem

Hi, When using shared objects on AIX 4.3 i am getting runtime problems. I have a small sample program which links to a shared object libray, oracle and system related libraries. At runtime it fails (gives segmentation fault and coredump ) in one proc file when executing login statement. But... (0 Replies)
Discussion started by: suman_jakkula
0 Replies

2. Programming

getting "mi_cmd_var_create: unable to create variable object" error msg

Hi, i am working in C in Fedora Eclipse 3.3.0 with gdb debugger. I am geting segmentation fault with an error message "mi_cmd_var_create: unable to create variable object" on debugging the program. What should I do to solve this problem? rgds, Dona_m (14 Replies)
Discussion started by: dona_m
14 Replies

3. UNIX for Dummies Questions & Answers

Object reference not set to an instance of an object

I am new to PHP and UNIX. I am using Apache to do my testing on a Windows Vista machine. I am getting this error when I am trying to connect to a web service. I did a search and did not see any posts that pertain to this. Here is my function: <?php function TRECSend($a, $b, $c, $d,... (0 Replies)
Discussion started by: EddiRae
0 Replies

4. Shell Programming and Scripting

How to change a Makefile from building static library to shared library?

Hi: I have a library that it only offers Makefile for building static library. It built libxxx.a file. How do I in any way build a shared library? (either changin the Makefile or direct script or command to build shared library) Thanks. (1 Reply)
Discussion started by: cpthk
1 Replies

5. UNIX for Dummies Questions & Answers

How to obtain list of object files in a shared (dynamic) library?

How can I simply obtain a list of the object files in a shared (dynamic) library. I am looking for the equivalent of "ar -t <lib>" for archived (static) libraries. Thanks in advance. :rolleyes: ---------- Post updated at 01:47 PM ---------- Previous update was at 12:16 PM ---------- The... (1 Reply)
Discussion started by: chatieremerrill
1 Replies

6. Programming

Symbol differences in STLport library and application object file

Hello, I compiled the object file of a binary and i could see the symbol , "void*std::__node_alloc<1,0>::_M_allocate(unsigned)", this is actually present as "void*std::__node_alloc<true,0>::_M_allocate(unsigned)" in the libstlport4.so.1 . This has been verified with "nm -C " command Please... (4 Replies)
Discussion started by: shafi2all
4 Replies

7. Linux

./configure problem for libsf library due to apparently missing libdb library.

Hello, ./configure script fails to configure libsf. Please check the following last few lines of configure script error. checking for db1/db.h... no checking for db.h... yes checking for dbopen in -ldb1... no configure: error: No libdb? No libsf. But find command shows the following; ... (4 Replies)
Discussion started by: vectrum
4 Replies

8. AIX

Add shared members from library to same library in a different directory

I'm trying to install libiconv to AIX 7.1 from an rpm off of the perzl site. The rpm appears to install but I get this error message. add shr4.o shared members from /usr/lib/libiconv.a to /opt/freeware/lib/libiconv.a add shr.o shared members from /usr/lib/libiconv.a to ... (5 Replies)
Discussion started by: kneemoe
5 Replies

9. Programming

How to initialize an object with another object of different class?

How to initialize an object of class say "A", with an object of type say "B". The following code give the error message "error: conversion from âAâ to non-scalar type âBâ requested" #include <iostream> using namespace std; class B; class A{ public: A() { cout <<"\nA()" << endl; } ... (1 Reply)
Discussion started by: techmonk
1 Replies
elf_version(3E) 														   elf_version(3E)

NAME
elf_version() - coordinate ELF library and application versions SYNOPSIS
Command: [flag]... file... [library]... DESCRIPTION
As elf(3E) explains, the program, the library, and an object file have independent notions of the "latest" ELF version. lets a program determine the ELF library's It further lets the program specify what memory types it uses by giving its own ver, to the library. Every program that uses the ELF library must coordinate versions as described below. The header file supplies the version to the program with the macro If the library's internal version (the highest version known to the library) is lower than that known by the program itself, the library may lack semantic knowledge assumed by the program. Accordingly, will not accept a working version unknown to the library. Passing a ver equal to causes to return the library's internal version, without altering the working version. If ver is a version known to the library, returns the previous (or initial) working version number. Otherwise, the working version remains unchanged and returns EXAMPLES
The following excerpt from an application program protects itself from using an older library. if (elf_version(EV_CURRENT) == EV_NONE) { /* library out of date */ /* recover from error */ } WARNINGS
The working version should be the same for all operations on a particular ELF descriptor. Changing the version between operations on a descriptor will probably not give the expected results. SEE ALSO
elf(3E), elf_begin(3E), elf_xlate(3E). elf_version(3E)
All times are GMT -4. The time now is 11:33 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy