call_external with PASCAL calling convention [message #13056] |
Fri, 02 October 1998 00:00 |
Eddie Breeveld
Messages: 4 Registered: July 1998
|
Junior Member |
|
|
Any call_external gurus out there?
We have a windows DLL that interfaces with a PC card and
we'd like it to be incorporated (via call_external) into IDL, but
can't make it work. The equivalent C program does work however!
We are using IDL Version 5.1 Win32 (x86) with windows 98.
The IDL program runs, but returns a 'CARD NOT FOUND' error, which
probably means that the parameters supplied to the routine are
incorrect.
I think there is a problem with the 'PASCAL' type definition of the
function 'W_7200_Initial', but call_external still returns the wrong
result with or without '/cdecl'.
The test idl program is:
card = 0b ; Byte
basadd2 = 0 ; Int
irq1 = 0b ; Byte
; test without cdecl
result = call_external('7200.dll', 'W_7200_Initial', $
card, basadd2, irq1, val=[1, 0, 0])
help, result, basadd2, irq1
end
The C program that works looks like:
#include <windows.h>
#include <stdio.h>
#include "c:\7200\include\7200.h"
unsigned char irq1;
unsigned short base_address2;
long status4;
void main(void)
{
status4 = W_7200_Initial(0, &base_address2, &irq1);
printf("Status= %ld\n"
"Base Address= 0x%X\n"
"IRQ= %d\n", status4, base_address2, irq1);
}
And the 7200.h file contains (amongst a lot of other stuff...)
typedef unsigned char U8;
typedef unsigned short U16;
int PASCAL W_7200_Initial(U8 card_number, U16 *base_address, U8
*irq_no );
We could write a C wrapper for 7200.dll, but this is messy. Is there
any other solution, or is there a bug in IDL with the /cdecl switch?
|
|
|