This is the mail archive of the cygwin@sourceware.cygnus.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Linking with Borland C


---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
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;
> }
> 

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?

==
-                \\||//
-----------o0O0--Earnie--0O0o------------
--        earnie_boyd@yahoo.com        --
-- http://freeyellow.com/members5/gw32 --
--------------ooo0O--O0ooo---------------

PS: Newbie's, you should visit my page.
_________________________________________________________
DO YOU YAHOO!?
Get your free @yahoo.com address at http://mail.yahoo.com

-
For help on using this list (especially unsubscribing), send a message to
"gnu-win32-request@cygnus.com" with one line of text: "help".


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]