From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Error while caling Labview DLL from VB2005

Dear all expert,
i'm a student and very new in Labview. Currently, i design a application using Labview8.2 and need convert it to dll. So that i can call it fom my VB2005.
 
I'm encounter an error, there is my computer "hang" when calling the labview dll. I suspect this may due unproper way i calling the labview dll in my VB program. So, really hope some one can give me any suggestion and modification to my program. I attach my vi and Vb program.
 
for your information,
i already install labview run time engine 8.2.1 and uncheck the "Loader Lock detected".
 
below is the Function Prototype create when i using Application Builder to build the dll.
 
void Bodeplot(unsigned short Operation, double Beta, double Frequency, double Kc, double Fcz, double Fcp, double Wz, double Wp, double Wzrhp, double k, double *Output)
 
Thank you very much.
0 Kudos
Message 1 of 2
(2,151 Views)
Hi cckoh,

A couple suggestions include:

1) Make sure you are using the correct .NET data types that map to the data type that LabVIEW uses. For example, your Operation paramter for your DLL is an unsigned short which is equivalent to a System.UInt16 in .NET.

2) You should be using ByRef instead of ByVal for your output parameters. For example, in your function prototye, you have double *Output. For example, when you import your unamanged DLL, the prototype you should use woudl be:

Declare Auto Function Bodeplot Lib "........."(ByVal Operation as System.UInt16, ........ ByRef Output as Double)

I tested this out and it loads the DLL, calls the function, and returns without problems.

Hope this helps!!
Best Regards,
Jonathan N.
National Instruments
Message 2 of 2
(2,135 Views)