03-13-2010 04:48 PM
Hi,
I've created a dll with LV8.6 and I'm trying to call it from VB6.0. I get the message 'Bad Dll Calling Convention. Run Time Error '49'.
Questions:
1. Any idea what might cause this error?
2. What is the meanig of the second function appear inh the h file ( long __cdecl LVDLLStatus(char *errStr, int errStrLen, void *module)😉
Thanks very much for your help
Rafi
The dll definition as appear in the h file:
void __stdcall EDASAnalysis(double f_sampleMHz, char FilePathFromOut[],
double *RMSValue, double *AmplitudePP);
long __cdecl LVDLLStatus(char *errStr, int errStrLen, void *module);
The Decleration in Visual Basic 6.0:
Declare Sub EDASAnalysis Lib "D:\NI Projects\eDAS400\DLL\ LV-DLL_V2\DLL\eDAS400_Analysis.dll" _
(ByVal f_sampleMHz As Long, ByVal FilePath As String, RMSValue As Long, AmplitudePP As Long)
Using the Function in VB6.0:
Call EDASAnalysis(10, "D:\NI Projects\eDAS400\Data Files\Samples\10MHz.txt", rms, pp)
03-15-2010 01:57 AM
03-15-2010 02:54 AM
Rafi2003 wrote:Hi,
I've created a dll with LV8.6 and I'm trying to call it from VB6.0. I get the message 'Bad Dll Calling Convention. Run Time Error '49'.
Questions:
1. Any idea what might cause this error?
2. What is the meanig of the second function appear inh the h file ( long __cdecl LVDLLStatus(char *errStr, int errStrLen, void *module)😉
Thanks very much for your help
Rafi
The dll definition as appear in the h file:
void __stdcall EDASAnalysis(double f_sampleMHz, char FilePathFromOut[],
double *RMSValue, double *AmplitudePP);
long __cdecl LVDLLStatus(char *errStr, int errStrLen, void *module);
The Decleration in Visual Basic 6.0:
Declare Sub EDASAnalysis Lib "D:\NI Projects\eDAS400\DLL\ LV-DLL_V2\DLL\eDAS400_Analysis.dll" _
(ByVal f_sampleMHz As Long, ByVal FilePath As String, RMSValue As Long, AmplitudePP As Long)
Using the Function in VB6.0:
Call EDASAnalysis(10, "D:\NI Projects\eDAS400\Data Files\Samples\10MHz.txt", rms, pp)
muks already pointed you to a discussion that shows the problem. VB can not call cdecl exported functions, so when you create your DLL you'll have to tell LabVIEW to use the stdcall calling convention to export the function for VB.
03-16-2010 02:23 AM