c++ - having object file symbols become dynamic symbols in executable -
I have several object files (from C ++) that get out of the build system. They have many When compiled in executable with GCC, these symbols are used by How can I expose them as dynamic symbols within compiled executables? I can change the build flags to make objects executable and executable, but how to eliminate C ++ files (GCC 4.8, LD 2.24) EDIT: I came to the question that may or may not be what I am asking, but I am not completely sure. You may want to take a look at Also, if none of the objects in the link does not refer to your exchanges during the link, Example: extern "C" linkage symbols I want to use in a program and accessible somewhere through
dlopen /
dlsym Are there.
nm -D & lt; Executable-here & gt; (i.e., afaik they are not dynamic symbols) have been used.
- export-dynamic ld :
-E --export-dynamic --no-export-dynamic When dynamically connected executables make use of the -E option or the --export-dynamic option, Add all the icons in the dynamic symbol table The dynamic symbol table is a group of symbols that appear on the run-off from dynamic objects. If you do not use any of these options (or use the --no-export-dynamic option to restore default behavior), then the dynamic symbol table will contain only those symbols that are mentioned in the link Some dynamic objects are referenced. If you use "dlopen" to load dynamic objects, which are required to refer back to the symbols defined by the program, instead of some other dynamic objects, you will need to use this option when the program Will have to add itself. Which symbols should be added to the dynamic symbol table using the dynamic list, if the output format supports it. See details of --dynamic-list Note that this option is specific to ELF target ports. PE targets support the same function to export all symbols from DLL or XE; See details of the below -export-all-symbols
- dynamic-list has been exported.
$ cat test.cc #include & lt; Stdio.h & gt; Int main () {printf ("hello, world \ n"); } Extern "C" zero export_this () {printf ("hello, export_this \ n" to the world); } $ G ++ -o test-w {all, extra} -w, - export-dynamic test Cc $ ./test hello, world $ nm - dynamic test | Grep export_this 00000000004007f5t export_this # & lt; ---- Here you go
Comments
Post a Comment