Dear Rooters,
I have a problem linking my code under windows. Usually I work with linux, where I have a makefile to create dictionaries and link my code together in shared library, that I load in the interpreter where i call my code from interactive macros.
Now I want to do same for windows using the msvc 8.0 compiler.
I managed to create a makefile for nmake (mostly by reading the discussions of Christian and Bertrand, thanks they were really helpful), which compiles and creates the dictionaries but i have a problem with the linking process.
If I understand correctly, I need to use bindexplib to create a .def file with the external symbols that the .dll will export, which are all public symbols basically.
Most of the time this works well, but i have some inline functions that use static data members for performance reasons and a class with physical constants that are kept in public-static-const data members. Those symbols don’t get exported by the dll, which is a problem for me, because i used them alot.
I also found out, by fiddling around with .def file, that when i remove the ‘data’ keyword behind those data members before calling the linker the symbols get exported and everything seems to work.
(I think i also read somewhere, that data members don’t get exportet by a dll… ?)
Is this behaviour of bindexplib intented? (Not exporting static data members?)
I attached a tar file with two visual c projects reproducing my problem. In project Linkerproblem an inline function uses a static data member of class TSimpleClass. When the object of class TUserClass calls this inline function the static data member of TSimpleClass would need to be accessed, but it is not available, therefore the linking of Linkerproblem2.dll fails.
(I know, that i could use a const data member that is initialised in the constructor to circumvent this, but for the data type that i use in my code this is no option i think, because it would mean, that the data type would need to initialize 10 variable each time the constructor is called, which is unefficient when the data type has only two data members.)
Any suggestions are welcome!
kind regards
Dirk Dodt
Linkerproblem.tar.gz (3.46 KB)