This is the mail archive of the cygwin@cygwin.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

load-time-linking a cygwin created Dll


Hello,

I've got a problem with a Dll, created with cygwin: My program (another Dll)
crashes with exit code 1 without any comment, when I try to load the Dll
implicitly at load-time. With explicite loading (LoadLibrary &
GetProcAdress) it works fine.

The header file for the Dll is:

-----

#ifdef STTK_DLL_EXPORT
 #define STKK_DLL_API __declspec(dllexport)
#else
 #define STKK_DLL_API __declspec(dllimport)
#endif

struct translation_data;

extern "C" STKK_DLL_API translation_data* initialize(const char* filename);
extern "C" STKK_DLL_API void translateAString(translation_data* p, const
char* source, char* dest);
extern "C" STKK_DLL_API void cleanUp(translation_data* p);

-----


The Dll is created via the -shared option, and the functions are exportet
via __declspec(dllexport). To prevent name mangeling problems, they are
declared as extern "C".

Since cygwin doesn't create an import library, I had to write a .def file to
generate one. This procedure seems quite strange, because the
__declspec(dllexport) stuff is a replacement for using .def files. Am I
wrong?

I searched the web and the manuals, but it didn't enlighten me (in fact, it
got a little bit darker). Is __declspec the microsoft way of creating Dlls
(and not portable), and I should avoid it?

Thanks in advance,

Mirko Vogel


--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]