10-03-2009 11:29 AM
Hi,
I have a question about calling dlls. I have a dll which I can call some of the functions, but not others. I get the "LabVIEW: An exception..." error on some of the functions. The function prototype I can call is:
_ScriptSleep@4(dword param_1)
calling convention = stdcall
This one works, but when I try to call this function, it does not work:
_ALeSetSpot@4(dword param_1)
calling convention = stdcall
Both of these functions have an "_" infront of them. I can't seem to figure out what I am doing wrong.
Solved! Go to Solution.
10-03-2009 01:25 PM
10-03-2009 04:12 PM
10-03-2009 04:54 PM
Regrettably I cannot run the DLL calls as it relies on further DLLs (e.g. sbdconnection.DLL) that I do not have.
I cannot see any obvious problem in your code.
I can see, that the two functions you have mentioned are exported by the DLL.
LabVIEW 8.2.1 sees the functions without mangled names (e.g. ScriptSleep).
The only thing you should change: A dword is usually a U32 in LabVIEW. You have specified an I32. This should not be a problem as long as you do not pass negative numbers to the DLL.
Hope this helps, Guenter
10-03-2009 05:42 PM
10-03-2009 06:08 PM
Can you send the vpro32.DLL, please? xtautolib.DLL also requires it and I do not have any idea where to get this DLL?
Is there a chance that I can run the VI then? Or is any hardware required?
Thanks in advance, Guenter
10-03-2009 11:48 PM
10-04-2009 07:36 AM
10-04-2009 10:19 AM
Guenter Mueller wrote:
Although I met this statement ("LabVIEW cannot call C++ DLLs.") quite often I have to say that I have occasionally met DLLs created in C++ and as long as the functions in these DLLs use simple data types there is a good chance that they will work with LabVIEW.
See here: Building a DLL with Visual C++, especially Step 3. This is not new. If the DLL is compiled so that the functions names are not decorated then the DLL will work, even if it's compiled with a C++ compiler. However, LabVIEW will not be able to instantiate classes from the DLL.
10-04-2009 10:40 AM
Right you are. Thanks for referring to the link that properly points out, that "Without C++ decoration, polymorphic functions are not possible."
To my opinion, no polymorphism and no object creation needs to be considered when shivels tries to use his DLL. There should be a chance to successfully call it from LabVIEW.
Regards, Guenter