delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/1998/09/21/15:36:16

From: jba AT lfpt DOT RWTH-Aachen DOT DE (Juergen Bausa)
Subject: Re: Linking with Borland C
21 Sep 1998 15:36:16 -0700 :
Message-ID: <199809210820.KAA00749.cygnus.gnu-win32@lisa.rwth-aachen.de>
To: anorland AT hem2 DOT passagen DOT se, gnu-win32 AT cygnus DOT com

>
>I have successfully created a DLL and linked it with an
>app compiled by BC, but it is cumbersome business. The
>problem, as I see it, is that you cannot use the same .DEF
>files with BC and dlltool since the exported names are
>decorated differently by the different tools.
>

Dear Anders,

I am very interested in your post, since I was trying (nearly) the same
thing. However, it seems to me, that you only addressed the linking
problem.

I am using another gcc-port (rsxnt) where I had no poblem in creating an
import-library and linking to it (or, using LoadLibrary & GetProcAddress).
I took the X11-libraries from Sergej, used only the DLL's and Headers and
created my own Inport-Libraries, which I then linked to my rsxnt-gcc program.
However, it crashed on every call of an X11-function.

The real problem is to execute a function in a cygnus-made dll, that
uses functions like 'malloc'. I think these functions are not correctly
initialized when the dll is loaded by a non-cygnus program. So, my question 
is: Is your example still working if you use this function foo:


int foo(int n)

{
	int    i;
	double *a=malloc(n*sizeof(double));


	for(i=0;i<n;i++) a[i]=i;
	i=(int)a[n-1];
	free(a);

	return i;
}

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