Helmut Dipper wrote:
when you say return do you mean it doesn't return the correct value or it doesn't return at all ? - ie it hangs ?I use nant rc1 on Windows XP.
I want to use wrapped functions out of a gcc-generated dll,
but detected following problem:
A function defined via task script doesn't return
when calling a function from a dll created by gcc.
Remarks:
- I attached all test files (zip-file was not possible).
- the build-script finishes when the inner function finishes
without any error message.
- if the dll is used in a main program, no problem occurs.
a main c program ? How about a c# console app using P/Invoke ?
- if the test-dll is created by MS Visual C, no problem occurs,
but due to other reasons I cannot switch to MS VC.
Interesting - does gcc create a PE format executable on windows/cygwin ?
I don't have cygwin gcc installed here at work - so I'll check it out tonight when I get home.
Ian
------------------------------------------------------------------------
#if defined(WIN32) # define DLL_EXPORT __declspec(dllexport)
#else
# define DLL_EXPORT /**/
#endif
#include <stdio.h> #include <string.h>
DLL_EXPORT char *dll_fct (char *par) { static char buf[1024 + 1];
printf("executing dll_fct\n");
buf[0] = 0; strcat(buf, "input: "); strcat(buf, par);
return buf; }
------------------------------------------------------------------------
#include <stdio.h> #include <string.h>
extern char *dll_fct (char *);
main () { printf("before\n");
printf("%s\n", dll_fct("hello"));
printf("after\n"); }
------------------------------------------------------------------------
<?xml version="1.0"?> <project name="test" default="test">
<script language="C#" prefix="test"> <imports> <import name="System.Runtime.InteropServices"/> </imports> <code> <![CDATA[ [DllImport("test.dll", EntryPoint="dll_fct",ExactSpelling=true, CharSet=CharSet.Ansi, CallingConvention=CallingConvention.StdCall )] private static extern string dll_fct(string par);
[Function("call")] public static string call(string par) { string res;
res = dll_fct(par);
return res; } ]]> </code> </script>
<target name="test"> <echo message="begin"/> <echo message="${test::call('test')}"/> <echo message="end"/> </target> </project>
------------------------------------------------------------------------
cl -IE:/progra~1/visual~1/VC98/include -DDEBUG /Z7 -DWIN32 /nologo /W2 -c fct.c /e/progra~1/visual~1/VC98/bin/link.exe /DLL /OUT:test.dll /LIBPATH:E:/progra~1/visual~1/VC98/lib /pdb:none /machine:I386 /nologo /incremental:no /subsystem:console fct.obj kernel32.lib
cl -IE:/progra~1/visual~1/VC98/include -DDEBUG /Z7 -DWIN32 /nologo /W2 -c main.c
/e/progra~1/visual~1/VC98/bin/link.exe /pdb:none /machine:I386 /nologo /incremental:no /subsystem:console /OUT:main.exe /LIBPATH:E:/progra~1/visual~1/VC98/lib main.obj fct.obj kernel32.lib
/e/progra~1/visual~1/VC98/bin/link.exe /pdb:none /machine:I386 /nologo /incremental:no /subsystem:console /OUT:main.exe /LIBPATH:E:/progra~1/visual~1/VC98/lib main.obj test.lib kernel32.lib
------------------------------------------------------------------------
gcc -O2 -c fct.c gcc -v -o test.dll -shared fct.o
gcc -O2 -c main.c
gcc -v -o main.exe main.o test.dll
------------------------------------------------------- SF email is sponsored by - The IT Product Guide Read honest & candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now. http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click _______________________________________________ Nant-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/nant-users
