[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Q: interfacing IDL to DLL



Hi,

 I feel to some extend the compiler (and esp. linker) You use might play an
important role. I can give You a brief report of my experiences with
Micro$$$ Visual Studio/VC 5.0:

1.) Suppose You want to create a WIN32 DLL (no MFCs)
2.) Declare the functions You want to export from  the DLL as LONG DLLEXPORT

3.) Enclose the prototypes in #ifdef __cplusplus extern "C" .... #endif
4.) The parameter list of the exported functions must be of (LONG argc,
void* argv[]) and nothing else; (#define LONG unsigned long)
5.) Take extreme care with the data formats of BYTE, INT, LONG and when
passind IDL strings. I advice You strongly to leave the memory management
either to the IDL part or to the C part. Don't mix.
6.) After compiling and linking the DLL have a look at its export table.
Make sure that the functions You want to export are listed there without
signatures (that's important and one reason why it is extremely difficult to
interface to C++). Remember the exact names. Put the DLL where You like (in
Your LIB search path might bre advantageous)
7.) Do the IDL CALL_EXTERNAL; make sure the path to the DLL is correct; use
the exact name of the function to be called. As this name is being looked up
in the DLL's export table make sure again the upper and lower cases are
correct !
8.) Pray !

Good luck !

Arno R. Schleich, MS, MD

"Herbert H. Tsang" wrote:

> Anyone has epxerience in interfacing IDL to C functions' DLL?  Is
> there anything special I need to do in order to make a DLL that's works?
>
> -- Herbert (tsang@vcn.bc.ca)

--
Functional Imaging Technologies GmbH
Siemensstr. 40/41
12247 Berlin
Germany

fon.: +49 (0)30 76 90 24 80
fax.: +49 (0)30 76 90 24 81

mailto:fit@functional-imaging.com
htp://www.functional-imaging.com