03-16-2005
HOw to load dynamic lib from a statically linked program ?
I need to load a dynamic library from a statically linked program. Is there a way without recompiling my program.
when i try to do that my program just crashes.
If not possible, how can I avoid crashing the program when i try to load the dynamic lib, again without recompiling.
If my question was vague, plz tell me !
advance thanx,
D.
10 More Discussions You Might Find Interesting
1. Programming
hi, every body. i have in trouble that how to load a dynamic library by hand.
for example, i know how to generate a dynamic library and how to link a dynamic library in makefile.
generate a dynamic library:
add -dy -G behind cc
link a dynamic library in makefile:
add -dy -Bdynamic behind cc... (0 Replies)
Discussion started by: subrain
0 Replies
2. Programming
how can i do static compilation in cc and -lldap
i have system defined and user defined header file.
Can any one suggest any site where from i can get some information about static and dynamic compilation.
Thankx (1 Reply)
Discussion started by: bhakti
1 Replies
3. Programming
I have a dynamically linked library, providing some functions needed in my project. I have successfully imported it into my VC ++ 6.0 project. Now, i am translating the project into pure C++ (such as avoiding using MFC classess) in Linux box.
Does anyone know if it makes sense to try to use... (2 Replies)
Discussion started by: cy163
2 Replies
4. Programming
Hi,
I have two dynamically loaded libraries (shared objects), both of which include functions of the same name - foo. When I call 'foo' from libA, it takes it from libB, although it is implemented in libA as well. Since we need the function to be called from libA, we tried linking it with the... (1 Reply)
Discussion started by: rimon
1 Replies
5. AIX
I think the default extension on AIX is .a
so for dynamic lib "libabc.a", we can simply link against it by specifying "-labc"
but here I have a dylib which been built by some one else called "libxyz.so" on AIX. once I say "-lxyz" the linker is only looking for libxzy.a but not .so after that.... (2 Replies)
Discussion started by: acerlinux
2 Replies
6. Programming
Hi,
I created two library libsum.so and libproduct.so. In the libproduct.so is defined function "product" that use function "sum" defined in libsum.so. So libproduct depends on libsum.
In main function I called product function by a dlopen request. Unfortunaly, when I execute program I have an... (5 Replies)
Discussion started by: shade82
5 Replies
7. Programming
I am attempting to port a program from OS X to Linux. It's C++ & Qt Creator and I did the original Windows to OS X port, so I tried to make it as POSIX-compliant as possible; the OS X port works well, and the Linux port builds and starts (it's on Ubuntu 9.10) but has some issues running.
The... (2 Replies)
Discussion started by: Hodapp87
2 Replies
8. Homework & Coursework Questions
I need help program in C... :create a program that runs two processes linked oven (1 Reply)
Discussion started by: gizmo16
1 Replies
9. Shell Programming and Scripting
Greetings to every one,
I have to access different clusters for computing.
But the problem is their lib paths are different. :eek:
How can i export some particular library paths for a particular machine ?
For example
Like cluster_1 (ip : 10.169.85.47)
export LD_libPATH="/opt/CUDA"
Like... (2 Replies)
Discussion started by: admax
2 Replies
10. AIX
I want to create a shared lib with certain libs statically linked to it. I can generate a fully shared lib as follows:
gcc -maix64 -DHAVE_CONFIG_H -I. -I./src -DHAVE_OPENSSL -I/usr/include/openssl -I/usr/include -I/usr/include/apr-1 -D_LARGEFILE64_SOURCE -I/usr/java8_64/include -shared -o... (0 Replies)
Discussion started by: amandeepgautam
0 Replies
dladdr(3C) dladdr(3C)
NAME
dladdr() - get the symbolic information for an address
SYNOPSIS
[flag]... cfile ... [library]...
Multithread Usage
This routine is thread-safe.
DESCRIPTION
is one of a family of routines that give the user direct access to the dynamic linking facilities (using the option on the compiler or com-
mand line). allows a process to obtain information about the symbol that most closely defines a given address. determines whether the
specified address is located within one of the load modules (executable or shared libraries) that make up the process' address space. An
address is deemed to fall within a load module when it is between the base address at which the load module was mapped and the highest vir-
tual address mapped for that load module, inclusive. If a load module fits this criteria, its dynamic symbol table is searched to locate
the nearest symbol to the specified address. The nearest symbol is the one whose value is equal to, or closest to but less than the speci-
fied address.
dlip is a pointer to a structure. The structure must be allocated by the user. The structure members are set by if the specified address
falls within one of the load modules. The structure contains the following members:
The fields of the structure contain the following:
dli_fname Pointer to the filename of the load module containing the address. The contents of this memory location can change
between calls to
dli_fbase Handle to the load module. This can be used as the first argument to
dli_sname Pointer to the name of the nearest symbol to the specified address. This symbol either has the same address, or is the
nearest symbol with a lower address. The contents of this memory location can change between calls to
dli_saddr Actual address of the nearest symbol. For code symbols, it contains the address of the OPD (Official Plabel Descrip-
tor) for the nearest code symbol.
dli_size (ELF process only) Size of the nearest symbol as defined in the dynamic symbol table.
dli_bind (ELF process only) Binding attribute of the nearest symbol as defined in the dynamic symbol table. The values for this
are those used for a symbol's binding in the ELF symbol table (see
dli_type Type of the nearest symbol. For ELF process, this is the same as the value for type in the dynamic symbol table. The
values for this are those used for a symbol's type in the ELF symbol table (see For SOM process, this can have the
value or as defined in
RETURN VALUE
If the specified address does not fall within one of the load modules, is returned; the contents of the structure are not modified. Other-
wise, a non-zero value is returned and the fields of the structure are set.
DIAGNOSTICS
If no symbol is found within the load module containing address whose value is less than or equal to address, the dli_sname, dli_saddr, and
dli_size fields are set to the dli_bind field is set to and the dli_type field is set to
For only a subset of externally visible symbols are typically exported: specifically those referenced by the load modules with which the is
linked. The exact set of exported symbols for any shared library or the can be controlled using the linker (see ld(1)).
ERRORS
If fails, a subsequent call to returns one of the following values:
Invalid symbol address in load module.
Cannot apply relocation in library.
Address not found in any load module.
Out of memory.
failed on entry to or exit from
failed on exit from
failed on entry to
SEE ALSO
cc(1), ld(1), sh(1), exec(2), dlclose(3C), dlerrno(3C), dlerror(3C), dlsym(3C).
Texts and Tutorials
(See the option)
(See manuals(5) for ordering information)
dladdr(3C)