This is the mail archive of the email@example.com
mailing list for the Cygwin project. See the Cygwin
home page for more information.
[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index] [Subject Index] [Author Index] [Thread Index]
Excel-callable DLL [RE: CFORTRAN for cygwin/egcs?]
- To: "Billinghurst, David (RTD)" <David.Billinghurst@riotinto.com.au>
- Subject: Excel-callable DLL [RE: CFORTRAN for cygwin/egcs?]
- From: Mumit Khan <firstname.lastname@example.org>
- Date: Wed, 17 Mar 1999 11:06:14 -0600 (CST)
- cc: email@example.com
- Delivered-To: firstname.lastname@example.org
- Delivered-To: mailing list email@example.com
- In-Reply-To: <A9E96A79C068D211A6A90000C07BDF0D1DE699@CRTSMAIL>
- Mailing-List: contact firstname.lastname@example.org; run by ezmlm
- Sender: email@example.com
On Tue, 16 Mar 1999, Billinghurst, David (RTD) wrote:
> Yes please. I'd love an example of a DLL callable from Excel
I won't get a chance to make an example for a while, but here's the
1. You need to tell the compiler that the functions need to use the
stdcall calling convention and not the default cdecl. There are two
ways to do it:
a. You can attach an __attribute__((stdcall)) (or WINAPI or STDCALL
which are macros that expand to the attribute) to each exported
function. This is not possible in g77, so you need to use b.
b. Compile all the to-be-turned-into-DLL files with -mrtd, which tells
the compiler to use stdcall calling convention for all the functions.
In most cases, (b) is the simpler option since you don't need to modify
the source code at all.
2. if you're using Cygwin GCC (no -mno-cygwin), then you need to do supply
"special" entry point so that Cygwin DLL is initialized correctly when
it's loaded by Excel etc. Also, you need to make sure cygwin1.dll is in
your path when Excel loads your DLL.
$ dllwrap --entry __cygwin_noncygwin_dll_entry@12 [rest of the options]
I believe the examples in the dllhelpers package describe the rest.
BTW, this is exactly the same mechanism for creating a Java JNI using
Cygwin DLL. (1) is taken care of automatically since Java headers define
a macro that essentially makes the calling convention stdcall. See my
java-jni-examples package for more info.
Want to unsubscribe from this list?
Send a message to firstname.lastname@example.org