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
OTOOL(1)						      General Commands Manual							  OTOOL(1)

NAME
otool - object file displaying tool SYNOPSIS
otool [ option ... ] [ file ... ] DESCRIPTION
The otool command displays specified parts of object files or libraries. If the, -m option is not used, the file arguments may be of the form libx.a(foo.o), to request information about only that object file and not the entire library. (Typically this argument must be quoted, ``libx.a(foo.o)'', to get it past the shell.) Otool understands both Mach-O (Mach object) files and fat file formats. Otool can display the specified information in either its raw (numeric) form (without the -v flag), or in a symbolic form using macro names of con- stants, etc. (with the -v or -V flag). At least one of the following options must be specified: -a Display the archive header, if the file is an archive. -S Display the contents of the `__.SYMDEF' file, if the file is an archive. -f Display the fat headers. -h Display the Mach header. -l Display the load commands. -L Display the names and version numbers of the shared libraries that the object file uses. -D Display just install name of a shared library. -s segname sectname Display the contents of the section (segname,sectname). If the -v flag is specified, the section is displayed as its type, unless the type is zero (the section header flags). Also the sections (__OBJC,__protocol), (__OBJC,__string_object) and (__OBJC,__run- time_setup) are displayed symbolically if the -v flag is specified. -t Display the contents of the (__TEXT,__text) section. With the -v flag, this disassembles the text. And with -V, it also symboli- cally disassembles the operands. -d Display the contents of the (__DATA,__data) section. -o Display the contents of the __OBJC segment used by the Objective-C run-time system. -r Display the relocation entries. -c Display the argument strings (argv[] and envp[]) from a core file. -I Display the indirect symbol table. -T Display the table of contents for a dynamically linked shared library. -R Display the reference table of a dynamically linked shared library. -M Display the module table of a dynamically linked shared library. -H Display the two-level namespace hints table. The following options may also be given: -p name Used with the -t and -v or -V options to start the disassembly from symbol name and continue to the end of the (__TEXT,__text) sec- tion. -v Display verbosely (symbolically) when possible. -V Display the disassembled operands symbolically (this implies the -v option). This is useful with the -t option. -X Don't display leading addresses when displaying contents of sections. -arch arch_type Specifies the architecture, arch_type, of the file for otool(1) to operate on when the file is a fat file. (See arch(3) for the currently know arch_types.) The arch_type can be "all" to operate on all architectures in the file. The default is to display only the host architecture, if the file contains it; otherwise, all architectures in the file are shown. -m The object file names are not assumed to be in the archive(member) syntax, which allows file names containing parenthesis. Apple Computer, Inc. April 30, 2002 OTOOL(1)
All times are GMT -4. The time now is 07:11 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy