Subject: Re: load-time-linking a cygwin created Dll
From: "Gerrit P. Haase" <[email-masked]>
To: "Mirko Vogel" <[email-masked]>, <[email-masked]>
Date: Thu, 13 Sep 2001 02:39:00 +0200

Mirko Vogel schrieb am 2001-09-12, 17:08:

>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?

I don't know if you has been here, but it may help to get a little
more insight:
http://www.neuro.gatech.edu/users/cwilson/cygutils/V1.1/dll-stuff/

Gerrit

-- 
=^..^=

--
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/