Sponsored Content
Full Discussion: export-dynamic
Top Forums Programming export-dynamic Post 302078449 by Hitori on Friday 30th of June 2006 01:29:29 PM
Old 06-30-2006
This is not what I meant
Suppose I have 2 files: main.c, lib.c
Function func1() is defined in main.c, and lib.so is loaded from main.c: dlopen("lib.so", RTLD_LAZY)
Then func1() is called from lib.c. Becouse of this I need to put all symbols to the dynamic symbol table:
gcc -g -Wl,--export-dynamic,-rpath,. -o main main.o -ldl
How can put only func1() to the dynamic symbol table (omitting other symbols)?
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

confusion with export

Hi, I have written the following two scripts. a.ksh ---> FPATH=/users/kushard autoload b b echo "From a.ksh::" $aa b ---> function b { typeset aa aa="TRUE." echo "From b::" $aa export aa } (1 Reply)
Discussion started by: kdipankar
1 Replies

2. UNIX for Dummies Questions & Answers

Mount Export

Apologies first -- I am a complete AIX moron but I have to figure this out to get our new system online. I am a programmer, not a sysad, but our AIX/UNIX admin is in the hospital. Apologies first -- I am a complete AIX moron but I have to figure this out to get our new system online. I am a... (1 Reply)
Discussion started by: AIXdumb455
1 Replies

3. Shell Programming and Scripting

export???

I am trying to export the variable OBJ2 and set it to done. Can some one please let me how to do this? I have tried editing my .bashrc file with this echo <VARIABLE_NAME>=<"OBJ2"> But that wont seem to work... (1 Reply)
Discussion started by: Justinkase
1 Replies

4. BSD

How to export

Hi I need to export some directpry path like below: var1=/<>/<>/<> export var1 This is my basic idea. I tried export var1=/<>/<>/<> after executing this in a shell i did an echo of the var1. But nothing happened. Can you please help me with this. I need to srite a script to... (4 Replies)
Discussion started by: jisha
4 Replies

5. Shell Programming and Scripting

About export

Hi all, I am calling a script from main script. The called script (second script) have to return some value, i can use exit to pass but in exit i have to pass some other value. i used "export Var", but this command resides in a function of second script. could you please tell me how to... (3 Replies)
Discussion started by: Arunprasad
3 Replies

6. Solaris

export DISPLAY

rsh to host2 from host1 and from host2 rsh into host3 Is it possible to display a GUI from host3 through host2 and onto host1? (1 Reply)
Discussion started by: eddiet
1 Replies

7. UNIX for Advanced & Expert Users

Sql dynamic table / dynamic inserts

I have a file that reads File (X.txt) Contents of record 1: rdrDESTINATION_ADDRESS (String) "91 971502573813" rdrDESTINATION_IMSI (String) "000000000000000" rdrORIGINATING_ADDRESS (String) "d0 movies" rdrORIGINATING_IMSI (String) "000000000000000" rdrTRAFFIC_EVENT_TIME... (0 Replies)
Discussion started by: magedfawzy
0 Replies

8. Shell Programming and Scripting

export. I know it, but...

Hello, I have the following command at the "Shell": export PATH=${PATH}:${ANT_HOME}/bin I know what "export" does and the ANT_HOME part. But, regarding the following part: ${PATH} What is "PATH" Supposed to be here. In other words, what is the value of "PATH". As far as for... (4 Replies)
Discussion started by: SWEngineer
4 Replies

9. Shell Programming and Scripting

whoami export

how can I use whoami on a script for ordinary user? it always says command not found. pls help #!/bin/ksh W='whoami' DATE=`date "+%Y-%m-%d %H:%M:%S"` echo " $DATE- by $W" result 2011-03-29 09:46:16 - by you wil noticed the by is blank...pls help..but in root, it works (1 Reply)
Discussion started by: lhareigh890
1 Replies

10. Ubuntu

How use export

Hello, I'm trying to use export for non use "./" when I execute a program. I mean "program" in place of "./program" I tried this: export doit=program But doesn't work the answer is: doit command not found Then, I see the variables using export, and I can see: ... (1 Reply)
Discussion started by: NewBe
1 Replies
DLFCN(3)						   BSD Library Functions Manual 						  DLFCN(3)

NAME
dlopen, dlclose, dlsym, dlvsym, dladdr, dlctl, dlerror -- dynamic link interface LIBRARY
(These functions are not in a library. They are included in every dynamically linked program automatically.) SYNOPSIS
#include <dlfcn.h> void * dlopen(const char *path, int mode); int dlclose(void *handle); void * dlsym(void * restrict handle, const char * restrict symbol); void * dlvsym(void * restrict handle, const char * restrict symbol, const char *version); int dladdr(void * restrict addr, Dl_info * restrict dli); int dlctl(void *handle, int cmd, void *data); char * dlerror(void); DESCRIPTION
These functions provide an interface to the run-time linker ld.so(1). They allow new shared objects to be loaded into the process' address space under program control. The dlopen() function takes the name of a shared object as the first argument. The path argument can be specified as either an absolute pathname to a shared object or just the name of the shared object itself. When an absolute pathname is specified, only the path provided will be searched. When just a shared object name is specified, the same search rules apply that are used for ``intrinsic'' shared object searches. (see ld.elf_so(1)) Shared libraries take the following form: ``lib<name>.so[.xx[.yy]]''. The shared object is mapped into the address space, relocated, and its external references are resolved in the same way as is done with the implicitly loaded shared libraries at program startup. If the first argument is NULL, dlopen() returns a handle on the global symbol object. This object provides access to all symbols from an ordered set of objects consisting of the original program image and any dependencies loaded during startup. The mode parameter specifies symbol resolution time and symbol visibility. One of the following values may be used to specify symbol resolu- tion time: RTLD_NOW Symbols are resolved immediately. RTLD_LAZY Symbols are resolved when they are first referred to. This is the default value if resolution time is unspecified. One of the following values may be used to specify symbol visibility: RTLD_GLOBAL The object's symbols and the symbols of its dependencies will be visible to other objects. RTLD_LOCAL The object's symbols and the symbols of its dependencies will not be visible to other objects. This is the default value if visibility is unspecified. To specify both resolution time and visibility, bitwise inclusive OR one of each of the above values together. If an object was opened with RTLD_LOCAL and later opened with RTLD_GLOBAL, then it is promoted to RTLD_GLOBAL. Additionally, one of the following flags may be ORed into the mode argument: RTLD_NODELETE Prevents unload of the loaded object on dlclose(). The same behaviour may be requested by -z nodelete option of the static linker ld(1). RTLD_NOLOAD Only return valid handle for the object if it is already loaded in the process address space, otherwise do not load the object and return NULL. dlopen() returns a handle to be used in calls to dlclose(), dlsym(), dlvsym(), and dlctl(). If the named shared object has already been loaded by a previous call to dlopen() (and not yet unloaded by dlclose()), a handle referring to the resident copy is returned. dlclose() unlinks and removes the object referred to by handle from the process address space. If multiple calls to dlopen() have been done on this object, or the object was one loaded at startup time, or the object is a dependency of another object then the object is removed when its reference count drops to zero. dlclose() returns 0 on success and non-zero on failure. dlsym() looks for a definition of symbol in the shared object designated by handle, and all shared objects that are listed as dependencies. The symbol's address is returned. If the symbol cannot be resolved, NULL is returned. dlsym() may also be called with special handle values. dlsym() respects symbol visibility as specified by the dlopen() mode parameter. How- ever, the symbols of an object's dependencies are always visible to it. All shared objects loaded at program startup are globally visible. Only the symbols in the main executable that are referenced by a shared object at link time will be visible unless it has been linked with the --export-dynamic option where all of its symbols will be visible. The following special handle values may be used with dlsym(): NULL Interpreted as a reference to the executable or shared object from which the call is being made. Thus an object can reference its own symbols and the symbols of its dependencies without calling dlopen(). RTLD_DEFAULT All the visible shared objects and the executable will be searched in the order they were loaded. RTLD_NEXT The search for symbol is limited to the visible shared objects which were loaded after the one issuing the call to dlsym(). Thus, if dlsym() is called from the main program, all the visible shared libraries are searched. If it is called from a shared library, all subsequently visible shared libraries are searched. RTLD_SELF The search for symbol is limited to the shared object issuing the call to dlsym() and those shared objects which were loaded after it that are visible. dlvsym() does the same as dlsym() but takes a version string as an additional argument. Both the symbol and the version must match in order for the symbol to be resolved. dladdr() examines all currently mapped shared objects for a symbol whose address -- as mapped in the process address space -- is closest to but not exceeding the value passed in the first argument addr. The symbols of a shared object are only eligible if addr is between the base address of the shared object and the value of the symbol ``_end'' in the same shared object. If no object for which this condition holds true can be found, dladdr() will return 0. Otherwise, a non-zero value is returned and the dli argument will be used to provide information on the selected symbol and the shared object it is contained in. The dli argument points at a caller-provided Dl_info structure defined as follows: typedef struct { const char *dli_fname; /* File defining the symbol */ void *dli_fbase; /* Base address */ const char *dli_sname; /* Symbol name */ const void *dli_saddr; /* Symbol address */ } Dl_info; The structure members are further described as follows: dli_fname The pathname of the shared object containing the address addr. dli_fbase The base address at which this shared object is loaded in the process address space. This may be zero if the symbol was found in the internally generated ``copy'' section (see link(5)) which is not associated with a file. dli_sname points at the nul-terminated name of the selected symbol dli_saddr is the actual address (as it appears in the process address space) of the symbol. Note: both strings pointed at by dli_fname and dli_sname reside in memory private to the run-time linker module and should not be modified by the caller. In dynamically linked programs, the address of a global function will point to its program linkage table entry, rather than to the entry point of the function itself. This causes most global functions to appear to be defined within the main executable, rather than in the shared libraries where the actual code resides. dlctl() provides an interface similar to ioctl(2) to control several aspects of the run-time linker's operation. This interface is currently under development. dlerror() returns a character string representing the most recent error that has occurred while processing one of the other functions described here. If no dynamic linking errors have occurred since the last invocation of dlerror(), dlerror() returns NULL. Thus, invoking dlerror() a second time, immediately following a prior invocation, will result in NULL being returned. ERRORS
The error ``Cannot dlopen non-loadable /usr/lib/libpthread.so.1'' is generated when a program dlopen()s a module that needs libpthread but isn't linked against it itself. SEE ALSO
ld(1), rtld(1), link(5) HISTORY
Some of the dl* functions first appeared in SunOS 4. BSD
June 25, 2011 BSD
All times are GMT -4. The time now is 11:04 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy