Subject: Re: Linking with Borland C
From: [email-masked] (Earnie Boyd)

22 Sep 1998 12:52:31 -0700
Message-ID: <[email-masked]>
Reply-To: [email-masked]
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
To: Juergen Bausa <[email-masked]>, [email-masked],
        [email-masked]

---Juergen Bausa <[email-masked]> 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------------
--        [email-masked]        --
-- 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
"[email-masked]" with one line of text: "help".