|
Can't use _declspec(dllimport) in SWIG to import data from DLL: msg#00118programming.swig
Hi, there. I'm building a Java interface for some C++ classes I have (SWIG 1.3.21 + Windows + Visual C++ 6.0). Those classes exist in a DLL. In that DLL there is one global object that is being exported from the DLL as: class _declspec(dllexport) Log g_log(); It is imported by the clients of my DLL by the code: class _declspec(dllimport) Log g_log(); Neither line is accepted by SWIG. So I went ahead and put macros defining both _declspecs and set them to blank in the SWIG interface file. I could get away with the _declspec(dllexport) part, but without the _declspec(dllimport) I can't get the SWIG dll to link. It can't find the symbol "class Log g_log()". In fact, by omitting the _declspec(dllimport), VC++ assumes that is an export declaration so I can't get to tell the compiler to look for that symbol in a dll. As expected SWIG generates this: class Log g_log(); My current workaround is to manually change the c++ file generated by SWIG to have this instead: class _declspec(dllimport) Log g_log(); Then all works fine.
Ricardo --
|
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| Previous by Date: | Version 1.3.22 and -ldflags command line option: 00118, Bill Spotz |
|---|---|
| Next by Date: | Re: Version 1.3.22 and -ldflags command line option: 00118, William S Fulton |
| Previous by Thread: | Version 1.3.22 and -ldflags command line optioni: 00118, Bill Spotz |
| Next by Thread: | Re: Can't use _declspec(dllimport) in SWIG to import data from DLL: 00118, William S Fulton |
| Indexes: | [Date] [Thread] [Top] [All Lists] |
| News | FAQ | advertise |