I'm hoping someone can help me with a problem I'm having exporting a function from a DLL. I need to hook some APIs in a DLL. I'm trying to do this by writing a shim DLL that forwards most APIs to the original DLL. The original DLL has two functions with similar names. The name of one of the functions is the same name as the other function with an underscore prepeneded. For instance, FooBar and _FooBar. However, the DLL I generate doesn't export the function with the underscore, _FooBar.
Here's a short example that illustrates the problem. I wrote a .def file for my shim DLL and the original DLL.
Thanks for the reply. Unfortunately, someone else broke the leading underscore rule and I'm stuck with it. I only have source code for parts of the original DLL and no source code for it's clients. If I wanted to avoid the leading underscores, I would have to modify and recompiling the original DLL and all it's clients.
Happily, I found a work around. Instead of exporting FooBar and _FooBar in a .def file, I put the following pragmas in a C module. When I linked this, both symbols were exported.