Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com From: "Siegfried Heintze" To: Subject: RE: need -mrtd to create Excel DLL? Date: Tue, 13 Jul 2004 12:57:55 -0600 MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit In-Reply-To: <20040713173933.GA2492@ingber.com> Message-Id: <200407131259156.SM01156@fasolt> X-IsSubscribed: yes Lester, It works! Thank you. Assuming these will be archived, maybe this can help someone else. Since I'm wondering if Excel was caching something, I decided to use C# and it works! Thanks, Siegfried Here is the example of calling cygwin C from C#: ------begin here ------ // Begin commands to execute this file using MS.NET with bash // cat <cdll.h // #ifndef cdll_h_included // #define cdll_h_included // // /* // * When building the DLL code, you should define BUILDING_DLL so that // * the variables/functions are exported correctly. When using the DLL, // * do NOT define BUILDING_DLL, and then the variables/functions will // * be imported correctly. // * // * You need to be using egcs-1.1.1 or newer. // * // * Building the DLL: // * - define BUILDING_DLL, which defines DLLIMPORT __attribute__((dllexport)) // * Building the client code: // * - DO NOT define BUILDING_DLL, which defines DLLIMPORT to be one // * __attribute__((dllimport)) // */ // // #if BUILDING_DLL // # define DLLIMPORT __declspec (dllexport) // #else /* Not BUILDING_DLL */ // # define DLLIMPORT __declspec (dllimport) // #endif /* Not BUILDING_DLL */ // // DLLIMPORT double dll_double_square (double); // #endif /* cdll_h_included */ // EOF // cat <cdll.c // #include "cdll.h" // DLLIMPORT double // dll_double_square (double d) // { // return d * d; // } // EOF // gcc cdll.c -DBUILDING_DLL=1 -mrtd -g -O2 -Wall -mno-cygwin -mrtd -shared -o cdll.dll -Wl,--out-implib=cdll.lib -Wl,--compat-implib -Wl,--add-stdcall-alias -Wl,--enable-stdcall-fixup -Wl,--enable-auto-import -Wl,--enable-auto-image-base -Wl,--export-all-symbols -Wl,--output-def=cdll.def -Wl,--no-whole-archive // c:/WINDOWS/Microsoft.NET/Framework/v1.1.4322/csc /checked /incr /debug /out:test.exe test.cs // ./test 4 2 10 2.3 4.23 // rm test.exe // rm test.exe.incr // rm test.pdb // End commands to execute this file using MS.NET with bash class test { [System.Runtime.InteropServices.DllImport ("cdll.dll", CallingConvention=System.Runtime.InteropServices.CallingConvention.Cdecl)] public static extern double dll_double_square(double d); static public void Main(string[] args){ System.Console.WriteLine("hello"); for(int ii = 0; ii