From: stanton AT haas DOT berkeley DOT edu (Richard Stanton) Subject: DLL help needed... 22 Dec 1997 13:33:58 -0800 Message-ID: <199712222111.NAA04315.cygnus.gnu-win32@grether.haas.berkeley.edu> Mime-Version: 1.0 (generated by SEMI MIME-Edit 0.92 - "Oyanagi") Content-Type: text/plain; charset=US-ASCII To: gnu-win32 AT cygnus DOT com I'm getting close to creating working DLLs. With a lot of help from Giandomenico De Sanctis, I've actually created a DLL file that passes/returns short ints, and can be used in Excel 97, but I'm having trouble when the functions pass/return double arguments. In fact, I'm having trouble even in plain C. Here's a simple example, which produces the following (odd looking) output [c:\projects\excel]exe i 10.000000, j 11.000000, k -1.#IND00 When I pass everything as short instead of double, it all seems to work OK. Any idea what I'm doing wrong? I attach all the necessary files to get this to compile. By the way, I'm compiling this using mingw32. Thanks a lot. Richard Stanton ------------------------------------------------------------------------ exe.c: ------------------------------------------------------------------------ #include double RHS (double x, double y) __attribute__((stdcall)); int main() { double i, j, k; i = 10; j = 11; k = RHS(i,j); printf ("i %lf, j %lf, k %lf\n", i, j, k); return 0; } ------------------------------------------------------------------------ dll.c: ------------------------------------------------------------------------ double RHS (double x, double y) { return (x + y); } ------------------------------------------------------------------------ dll.def: ------------------------------------------------------------------------ EXPORTS RHS RHS AT 16=RHS ------------------------------------------------------------------------ makefile: ------------------------------------------------------------------------ dll.dll: dll.c dll.def dlltool --def dll.def --output-exp dll.exp --output-lib dll.a --dllname dll.dll -k gcc -g -o dll.dll dll.c dll.exp -Xlinker --image-base=0x40000000 -dll -mrtd -ggdb3 exe.exe: exe.c dll.dll gcc exe.c dll.a -g -o exe.exe ------------------------------------------------------------------------ - For help on using this list (especially unsubscribing), send a message to "gnu-win32-request AT cygnus DOT com" with one line of text: "help".