This is the mail archive of the mailing list for the Cygwin project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Q. on creating DLL's for use w/ excel (export names without @0, @4 etc?) (cygwin 1.3.13-2)

I've searched on google for some references to interfacing cygwin with win32
dll's. I've made a little progress but am kind of stuck creating DLL's
inside cygwin. The method I am using is the following:

/* foo.c */
#include <windows.h>
int WINAPI foobar() {  return 1234; }

gcc -mno-cygwin foo.c -c
gcc -Wl,--out-implib,libfoo.import.a -mno-cygwin -shared -o foo.dll foo.o

When I look at the DLL file with MSVC's "depends.exe" I see the symbol is
"foobar@0" -- and I guess the @0 refers to how many bytes the function args
take (I get @4 with a pointer to double, etc.). The only way I can make the
symbols available to excel's visual basic interface is to cheat and hexedit
foo.dll to change "foobar@0" to "foobarX0". Then I can put a few lines in my
excel modules like
Declare Function foobarX0 Lib "e:\dlltest\foo.dll" () As Integer

Function MattVersion()
    Dim i As Integer
    i = foobarX0()
    MattVersion = "MW" + Str(i)
End Function

Surely there is a better way. Can anyone suggest a better technique? 

Unsubscribe info:
Bug reporting:

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]