delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2001/09/12/17:14:26

Mailing-List: contact cygwin-help AT sourceware DOT cygnus DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT sources DOT redhat DOT com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin AT sources DOT redhat DOT com>
List-Help: <mailto:cygwin-help AT sources DOT redhat DOT com>, <http://sources.redhat.com/ml/#faqs>
Sender: cygwin-owner AT sources DOT redhat DOT com
Delivered-To: mailing list cygwin AT sources DOT redhat DOT com
Message-ID: <025501c13bcf$20497a80$37fe0280@is.cs.cmu.edu>
From: "Mirko Vogel" <mirko DOT vogel AT gmx DOT de>
To: <cygwin AT cygwin DOT com>
Subject: load-time-linking a cygwin created Dll
Date: Wed, 12 Sep 2001 17:08:37 -0400
MIME-Version: 1.0
X-Priority: 3
X-MSMail-Priority: Normal
X-Mailer: Microsoft Outlook Express 5.00.2314.1300
X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2314.1300

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/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019