I am try to create a import library from a dll. The dll is linked with other static library. When a function present in static library is called the app crashes. I don't know why????
This is what i am doing..

Application.exe is calling a Network.dll function "fnStartSimulation"
fnStartSimulation calls init function present is same dll.
init function is calls config function present in Stack.lib.

Now i am able to call till init function.

This is my make file
For Stack.lib...
gcc -O3 -Wall -c -fmessage-length=0 -o Stack.o Stack.c -I $(Include)
ar -r Stack.lib Stack.o

for Network dll.......
gcc -c -fmessage-length=0 -w -shared -o Network.o Network.c -I $(INCLUDE)
gcc -Wl -shared --export-all-symbols Network.o -o Network.dll -lStack -L$(LIBDIR)
dlltool -z Network.def --export-all-symbols Network.dll
dlltool -d Network.def -l Network.lib

For Application.exe ....
gcc -c -o Application.o Application.c
gcc -o Application.exe Application.o -lNetwork -L $(lib)

I am using Mingw-gcc compiler.
What's am i doing wrong???

When i am trying with visual studio it's working fine.

Shashi Kant