
VB 4.0 calling a Visual C++ 4.0 DLL
Hello:
I've created a DLL in Visual C++ 4.0 (Standard Edition) and am calling it
from VB 4.0.
A) Initially my function declaration was:
extern "C"
{
DllExport int cvt_timezone( char *in_datetime_str,
int in_timezone,
int in_DS_observed,
int out_timezone,
int out_DS_observed,
char *out_datetime_str );
Quote:
}
I can call this DLL function from a VC++ console application, and am able
to step through it in the de{*filter*}.
In VB 4.0, I declared the following, remembering that a VC++ int is really
32bits:
Declare Function cvt_timezone Lib "cvttz.dll" (ByVal in_str$, ByVal in_tz&,
ByVal in_dso&, ByVal out_tz&, ByVal out_dso&, ByVal out_str$) As Long
I got the "Bad DLL calling convention (Error 49)" message. (I tried
various changes in the declaration, and got the same error.)
B) One of the explanations from VB's help talks about needing the Pascal
calling convention, which is no longer supported directly in VC++ 4.0. So,
from what I could understand from VC++'s help, I then declared the function
in VC++ 4.0 as:
extern "C"
{
DllExport int WINAPI cvt_timezone( char *in_datetime_str,
int in_timezone,
int in_DS_observed,
int out_timezone,
int out_DS_observed,
char *out_datetime_str );
Quote:
}
This time I got a "Specified DLL function not found (Error 453)".
Can anyone tell me what I'm doing wrong and/or how to emulate the Pascal
calling convention in VC++ 4.0?
--Jenny