c++ - Is there a .def file equivalent on Linux for controlling exported function names in a shared library? -
I am creating a shared library at Ubuntu 9.10. I want to export a subset of my works only from the library. On the Windows platform, this will be done using a module definition ( .def
) file that lists the external and internal names of the jobs exported from the library.
I have the following questions:
-
How can I restrict the exported functions of shared libraries to those people (such as .def file equivalent)
-
Using .def files as an example, you can assign a function to an external name different from its internal name (useful to prevent name collisions and disturbances Re-aligning names etc)
-
In the window I have export command (I Vaccine) would be able to check the list of using export functions and addresses, a common way to do this on Linux what?
Only the few symbols in the shared object on Linux appear to be the most The common way is to - visibility = hidden for GCC
and then to decorate those symbols you want __ attribute __ ((visibility ("default"))
. < / P>
If you look for an export file like solution, you can type the linker option --reven-symbols-file = FILENAME
whatever you like.
I do not know an easy way to export a function with a different name from my function name, but possibly with an ELF editor. Edit: I think You can use the Linker script (take a look at the man page for the link) to assign the value to the symbols in the link phase, so give an alternate name for a given function. You have also not tried to do this.
You can use the readelf
command to see the symbols in the shared object. readelf -Ds
If I remember correctly.
Comments
Post a Comment