This is the mail archive of the
cygwin@sourceware.cygnus.com
mailing list for the Cygwin project.
RE: DLL's for use with other languages...
- To: gnu-win32 <gnu-win32 at cygnus dot com>
- Subject: RE: DLL's for use with other languages...
- From: David Essex <dessex at widow dot aracnet dot net>
- Date: Mon, 16 Jun 1997 11:10:19 -0400
- Cc: "Toni Harbaugh-Blackford" <HARBAUGH at FCRFV1 dot NCIFCRF dot GOV>, "J Russell Smyth" <jrussell at voicenet dot com>
J Russell Smyth wrote:
> ....
>What I want to know is can GNU-WIN32 or cygwin32 create DLLs that can be
used
>by Visual Basic?
Toni Harbaugh-Blackford you wrote:
> .....
>I too want to use cygwin32 DLLs with Visual Basic, and end up
>with the same error. I have tried using both relocatable and non-relocatable
>It would really be great if someone who had solved the problem of using
cygwin32
>DLLs with OTHER programs (especially Visual Basic) would provide an example.
I have a working example of a DLL which is compiled under gnu-win32 gcc and
works when it is called from Delphi2 and from another gnu-win32 C program.
It is auto loaded at run time, and is compiled using b18 under Win95. See
enclosed attached source code.
The strange thing about this working example is that it requires 2
different type of declarations. For example the following code will work;
/* gnu-win32 C program declaration */
extern int foo1(...);
extern char* foo2(...);
/* DLL C program function */
int foo1(...) { ... }
char* foo2(...) { ... }
int WINAPI dllEntry(HANDLE hDll, DWORD reason, LPVOID reserved)
{ return 1; }
/* Delphi2 Pascal program declaration */
function foo1(t: integer): Integer; stdcall;
function foo2(t: integer): Pchar; stdcall;
However similar code(i.e.: STDCALL IWNAPI) in the C as in the Delphi
calling program will compile but will not load.
/* gnu-win32 C program declaration */
extern int WINAPI foo1(...);
or
extern char* STDCALL foo2(...);
Any way it works. Hope this helps,
David
sample.tgz