Cygwin: allocate memory in DLL

  • Follow


Hello,

i'm not sure if this is the right place to ask (if so, i'm sorry):

I'm trying to create a dll using cygwin and gcc. The dll will be used
by a delphi programm.

When not allocating any memory with new, the dll works fine. When
allocating memory (one byte - char *c = new char) the delphi programm
crashes.

The Crash occurs with gcc Version 2.95.3-10 and Version 3.2 20020927
(prerelease). When compiling the dll with Visual C++ 6.0 SP5, the
programm (including memory allocation) works fine.

I am totally lost. Any hints? Thanks!

Best regards,

Christian Neise.

P.S.: 
With gcc I created the dll the following way:

gcc -c dll_test.cpp -o debug/dll_test.o
gcc -shared -o debug/dll_test.dll \
    -L/usr/lib \
    -Wl,--out-implib=debug/dll_test.dll.a \
    -Wl,--export-all-symbols \
    -Wl,--enable-auto-import \
    -Wl,--whole-archive debug/dll_test.o \
    -L/usr/lib \
    -Wl,--no-whole-archive -lc -lstdc++


P.P.S: Sorry, if this did not belong here.
0
Reply C 9/2/2003 9:04:26 AM

Christian Neise wrote:
....

> I am totally lost. Any hints? Thanks!
> 
> Best regards,
> 
> Christian Neise.
> 
> P.S.: 
> With gcc I created the dll the following way:
> 
> gcc -c dll_test.cpp -o debug/dll_test.o
> gcc -shared -o debug/dll_test.dll \
   ^^^ <- use g++
>     -L/usr/lib \
>     -Wl,--out-implib=debug/dll_test.dll.a \
>     -Wl,--export-all-symbols \
>     -Wl,--enable-auto-import \
>     -Wl,--whole-archive debug/dll_test.o \
>     -L/usr/lib \
>     -Wl,--no-whole-archive -lc -lstdc++
> 
> 
> P.P.S: Sorry, if this did not belong here.

You must link using g++ if your object contains C++ code.



0
Reply Gianni 9/2/2003 2:12:29 PM


1 Replies
377 Views

(page loaded in 0.043 seconds)

Similiar Articles:













7/21/2012 5:11:00 PM


Reply: