Linking with Borland C

Earnie Boyd
Mon Sep 21 22:08:00 GMT 1998

---Juergen Bausa <jba@lfpt.RWTH-Aachen.DE> wrote:
> The real problem is to execute a function in a cygnus-made dll, that
> uses functions like 'malloc'. I think these functions are not
> initialized when the dll is loaded by a non-cygnus program. So, my
> 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;
> }

IMHO it is most likely that functions that use malloc within the
cygwin.dll or functions built with the cygwin that use malloc routines
will always be a problem outside of the cygwin environment.  The
cygwin malloc emulates the UNIX functions including external variables
controlling the size of memory.

Since those variables don't exist naturally in Win32, if you expect it
to work at all you would have to take care that the external variables
were properly initialized and to use the cygwin mmalloc.a library.

Others who are more intune with the workings of the cygwin malloc, I'm
I wrong with this?  If not, what would have to be initialized and how?

-                \\||//
--        --
-- --

PS: Newbie's, you should visit my page.
Get your free address at

For help on using this list (especially unsubscribing), send a message to
"" with one line of text: "help".

More information about the Cygwin mailing list