Answer the question
In order to leave comments, you need to log in
How to remove function decoration?
There is a library with a function that returns a container. Something like this: std::set<std::string> function();
The library needs to be loaded dynamically, so to find this function you need to remove the decoration, how to do it? extern "C"
cannot be used because the function returns a C++ class. Under Windows, it seems possible to use a def file, but how to do this under Linux?
Answer the question
In order to leave comments, you need to log in
If the pod is dynamically loaded, meaning linking with .so , then it works (I write just in case, you never know).
It seems to me not the best idea to remove the decoration in the library itself, but there is another way.
You need to declare a C function in the library that will return the C++ function pointers you need.
This is a completely adequate way, for example Qt uses a similar approach, only the function constructs an object inherited from QPlugin
I'm not sure it's a good idea to return stuff like this from a library. Because the implementation of containers is not fixed. Therefore, it is better to get by with simpler types, or more complex types of self-written or COM enumerator interfaces.
If the library is statically linked and one compiler is assumed, then decoration should be forgotten.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question