Problems with Dynamic Library Access in View/Pro
[1/1] from: cyphre::seznam::cz at: 8-Apr-2002 11:11
Hi Holger and all on the List,
I have a problem regarding accesing DLLs from View/Pro:
I have this C function(watch out line breaks!):
from .h definition file:
...//this is value needed for the first argument of the funciton
#define DCSDKVersion 0x0154
#else
...//this is the structure needed as a input argument for the function
typedef struct{
DCCameraType CamType;
DCCameraType SpecificCamType;
BOOL DriverOpenFlag;
BOOL CameraOpenFlag;
BOOL ROMModeFlag;
} DCDriver, FAR *DCDriverPtr;
...//this is the fuction definition
DCOpenDriver(
SHORT FAR * Version, // This should be passed as the constant
// DCSDKVersion
DCDriverPtr Driver // This is a system dependent structure that
// contains information about the open
// driver.
);
or simmilar stuff in Visual basic interface layer:
....
Public Const DCSDKVersion = &H154
.....
Type DCDriver
CamType As Long
SpecificCamType As Long
DriverOpenFlag As Boolean
CameraOpenFlag As Boolean
ROMModeFlag As Boolean
Reserved As Integer
End Type
.....
Declare Function DCOpenDriver Lib "DC120VBIFLV154_32.DLL" Alias
[_DCILVBOpenDriver--8]
(Version As Integer, Driver As DCDriver) As Integer
....
So I did this in Rebol(this is for the VB layer but for the direct C dll
calls should be almost the same):
DC120vb.dll: load/library %DC120VBIFLV154_32.dll
DCSDKVersion: 340 ;154 hexadecimal
DCDriverPtr: [0 0 0 0 0]
DCDriver: make struct! [
CamType [integer!]
SpecificCamType [integer!]
DriverOpenFlag [integer!]
CameraOpenFlag [integer!]
ROMModeFlag [integer!]
Reserved [integer!]
] reduce DCDriverPtr
DCOpenDriver: make routine! [
version [integer!]
driver [
struct! [
CamType [integer!]
SpecificCamType [integer!]
DriverOpenFlag [integer!]
CameraOpenFlag [integer!]
ROMModeFlag [integer!]
Reserved [integer!]
]
]
return: [integer!]
] DC120vb.dll "[_DCILVBOpenDriver--8]"
but when trying:
>>probe DCOpenDriver DCSDKversion DCDriver
...Rebol crashes :-(
only when DCSDKVersion: 0 I got some strange number(which is different from
the error codes in the sdk) returned from the function.
The crash behavior is the same when I tried it using VB layer or dirctly
call the generc dll :((
Am I doing something wrong? It is a bug of Rebol? Anyone?
Regards
Cyphre