How to DLL with IDL? [message #5220] |
Wed, 01 November 1995 00:00 |
mbrown
Messages: 15 Registered: August 1995
|
Junior Member |
|
|
Help! I need to convert some C functions into
DLLs so I can call them from IDL. I tried a little test
program first, but it doesn't work. When I CALL_EXTERNAL,
it says that the DLL 'duplicate' is not in the file. My
IDL code is simply
Result = CALL_EXTERNAL('c:\gcc\drg\test.dll','duplicate',e,p)
I modeled my program after the example in the
\external\examples\sharelib directory. By the way, this example
looks somewhat different than that of other DLLs I've seen. Could
this be the difference between 16 and 32 bit DLLs? Anyway, here
is my C code. I'm using Watcom C++ to build it, if that matters
at all. Any help would be appreciated.
// Myron Brown
// Duplicate.dll
#include <windows.h>
#include <stdio.h>
// Prototypes
BOOL WINAPI DllMain(HINSTANCE hInst, ULONG ulReason, LPVOID lpReserved);
int WINAPI duplicate(int argc, char* argv[]);
// Windows entry point for DLL
BOOL WINAPI DllMain(HINSTANCE hInst, ULONG ulReason, LPVOID lpReserved)
{
return(TRUE);
}
// Copy p into e
int WINAPI duplicate(int argc, char* argv[])
{
int i,j;
double** e;
double** p;
if (argc != 3)
return(1);
e = (double**)(*argv[0]);
p = (double**)(*argv[1]);
for (i=0;i<20;i++)
for (j=0;j<20;j++)
e[i][j] = p[i][j];
return(0);
}
|
|
|