![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| High Level Programming Post questions about C, C++, Java, SQL, and other programming languages here. |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| How to export | jisha | BSD | 4 | 01-21-2008 03:06 AM |
| export??? | Justinkase | Shell Programming and Scripting | 1 | 12-03-2007 02:32 PM |
| nfs export permissions | psimoes79 | HP-UX | 1 | 10-13-2007 01:12 AM |
| confusion with export | kdipankar | Shell Programming and Scripting | 1 | 05-11-2006 02:07 AM |
| export variables | srishan | Shell Programming and Scripting | 4 | 07-06-2004 09:53 AM |
|
|
Submit Tools | LinkBack | Thread Tools | Display Modes |
| Forum Sponsor | ||
|
|
|
|||
|
If I understand your question:
dynamic loading means you know the symbol names and the libraries names ahead of time - for the all the entrypoints you are going to map dynamically by calling dlopen yourself... Right? Code:
nm myexcutablefile Am I on track so far? |
|
||||
|
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)? |
|
|||
|
Sorry. I did not understand.
Since you are in a GNU development environment do you know about libltdl? This allows you to handle what you are doing. See: http://www.gnu.org/software/libtool/...#Using-libltdl If you don't like that - what you have to do in code: do not directly reference the module you want by name, this is how you "hide" it from ld. Example: Code:
#include <stdlib.h>
#include <stdio.h>
#include <dlfcn.h>
int main(int argc, char **argv) {
void *libhandle=NULL;
double (*myfunc)(double);
char *errormsg=NULL;
libhandle = dlopen ("/lib/libwhatever.so.1", RTLD_LAZY);
if (!libhandle) {
fputs (dlerror(), stderr);
exit(EXIT_FAILURE);
}
myfunc = dlsym(libhandle, "myfunction");
if ((errormsg = dlerror()) != NULL) {
fputs(errormsg, stderr);
exit(EXIT_FAILURE);
}
printf ("%f\n", (*myfunc)(1.0));
dlclose(libhandle);
return 0;
}
Again, this is what I think you are saying: you have not "hidden" all the symbols. Correct me if I'm wrong. You can't play mix-n-match, some hidden, some not. |