Re: IDL 5.0 - call_external under Win95/NT [message #9409] |
Mon, 30 June 1997 00:00 |
Peter Mason
Messages: 145 Registered: June 1996
|
Senior Member |
|
|
On Sat, 28 Jun 1997, Karl Krieger wrote:
> Has anyone been succesful in getting the Dlltst32 example
> code to run under Win95 or NT4.0?
I haven't compiled RSI's, but I have compiled other DLLs for IDL 5.0
using the MS Visual C++ 2 compiler.
> Their example DLL works just fine, but recompiling with
> VisualC++ 5.0 whith the original function declarations
> (as "LONG WINAPI") gives a DLL where the respective
> functions are not exported (i.e. not visible to call_external).
It sounds like you might have left out explicitly specifying the .DEF
file in your project. You have to add it to your project as a "source
file", along with the .C file(s), I think.
> I had to change the function declarations to
> "__declspec( dllexport ) LONG" to get the functions visible
> to IDL. However, while the recompiled DLL works fine with
> IDL4.0.1, IDL5.0 will immediately crash if one starts
> the dlltst32.pro procedure.
The way IDL calls DLLs has changed in version 5.
IDL4 could quite happily work with DLLs in which the functions had been
exported without .DEF files, e.g., by means of "__declspec(dllexport)" in
MS C++ or "__export __syscall" in Watcom C. In IDL5, you *have to*
export by means of a .DEF file and define your routines to use the WINAPI
calling convention. (I think this .DEF file muckaround introduces an extra
level of indirection in the way the routines are called, or something - some
arcane Microsoft thing. Whatever the case, IDL5 appears to rely on it.)
I've complained to RSI about this, and they did express some willing to
sort it out. (Haven't done so yet, though.)
Peter Mason
|
|
|