delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/1997/10/23/00:16:35

From: gunther DOT ebert AT ixos-leipzig DOT de (Gunther Ebert)
Subject: Re: Error loading DLL. Please help.
23 Oct 1997 00:16:35 -0700 :
Message-ID: <344EEB8D.4461.cygnus.gnu-win32@ixos-leipzig.de>
References: <199710230122 DOT SAA21345 AT whimbrel DOT geog DOT ubc DOT ca>
Mime-Version: 1.0
To: Michael Cherkassoff <mcherk AT geog DOT ubc DOT ca>
Cc: gnu-win32 AT cygnus DOT com

Hi,

I have no idea why LoadLibrary doesn't like
gcc-created dlls (since importing via import table works), 
but if you follow the hints described below you may probably 
get closer to the cause of the problem.


Michael Cherkassoff wrote:
> 
> Hi,
> 
> I am trying to load .DLL with the following program:
> ----------- main.c ----------------
> #include <windows.h>
> 
> int main()
> {
>     HINSTANCE hDLL;
> 
>     hDLL = LoadLibrary("libfoo.dll");
>     if (hDLL == NULL)
>       {
>       unsigned int errorCode;
>       printf("Error");
>       errorCode = GetLastError();

Where do you think the last error comes from? LoadLibrary? printf?
Since printf performs some Win32 API calls internally it is very likely
that the error code which was set by LoadLibrary gets overridden. If you
want the error code which a particular function sets please call GetLastError
immediately after that function.


>       printf (" code is %d\n",errorCode);
>       }
>     else printf ("Success\n");
> }
> --------------------------------------------------
> 
> I get the message:
> 
> Error code is 0
> 
> if libfoo.dll is relocatable and
> 
> Error code is 11
> 
> if libfoo.dll is non-relocatable.
> 

net helpmsg 11

An attempt was made to load a program with an
incorrect format.


> I create my libfoo.dll using Fergus' Henderson Makefile.DLLs
> and it works perfectly for both relocatable and non-relocatable
> examples of calling functions (not loading libraries).
> 
> Any ideas why loading libraries doesn't work and how to
> make it work?
> 

Maybe there is still a bug in ld, you will have to wait until someone
fixes it or fix it yourself.


> (I care mostly about the relocatable libraries)
> 
> I am using b18 with the most recent Coolview.
> 
> Thanks,
> Michael.
> ------------------------------------------------------------
> Michael Cherkassoff  (mcherk AT geog DOT ubc DOT ca)
> Department of Geography,                 Tel: (604) 822-2663
> University of British Columbia, B.C.     Fax: (604) 822-6150
> -
> For help on using this list (especially unsubscribing), send a message to
> "gnu-win32-request AT cygnus DOT com" with one line of text: "help".

-- 

Gunther Ebert
iXOS Anwendungs-Software GmbH
Angerstrasse 40-42
D-04177 Leipzig

Phone : +49 341 48503-0
Fax   : +49 341 48503-99
E-mail: mailto:gunther DOT ebert AT ixos-leipzig DOT de
www   : http://www.ixos-leipzig.de
-
For help on using this list (especially unsubscribing), send a message to
"gnu-win32-request AT cygnus DOT com" with one line of text: "help".

- Raw text -


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