c++ - What is the right way to link to a DLL which was linked to a static library and other shared libraries? -


Greetings, I hope someone has patience to read. I have a setup which is a bit confusing to me. I have a source code directory generated by an Eiffel compiler. I want to use this output from Java, so I want a DLL for JNI, in which I have some JNI I'll implement the functions. When I compile the C code, I give a static library, which relies on some other libraries. So my setup is:

depends on myDLL.dll (C ++) [depends on -> staticLib.lib [depends on (> - ShareLibs1, sharelib 2 ...)

My C ++ project is compiled with Eclipse CDT, and I end up with 1 DLL. I can use this DLL from Java without any problem only need another dll in the path during execution. All the code from static library has been compiled in my DLL, and Java JNI call uses this code in lieu of my DLL.

I wanted to use the same DLL from another C ++ project, however, when I only link to DLL, then Linker complains that a specific symbol is not found. This symbol has been declared in the Extension in the stable library, so it should be somewhere in the dependency of the static library.

The only way to connect and compile DLL with C ++ project is by connecting to static library, which was included in DLL in the first place. So I end up with an .exe, which has two static libraries: one in DLL, the other within the XI.

Since Java code successfully uses DLL, I know that the static library has been compiled in DLL, but I can not escape it from being included twice in my C + + app. I'm also worried about including the same library twice, how are things handled during runtime? Can it cut me in an unexpected way?

Your recommendations will be highly appreciated for managing this setup.

Safe

If your 'second' DLL is declared in the static library The reason can not be added, it seems that the second DLL should not see that symbol (why it happens), or also depends on the static library.

It seems that is unwanted later, so you should try to figure out which path the linker is getting an unwanted symbol. Probably looks at the compiler through the header file when your DLL header is included ...


Comments