LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

How can I make a DLL in CVI and use it in Labviews ?

I have a great deal of code I'd like to move into either CIN's or DLL's for Labviews (from CVI). Is there a way I can setup CVI to create DLL's from CVI that will work in Labviews?
0 Kudos
Message 1 of 7
(3,611 Views)
Any DLL created by CVI will work in LabView.
To make your life easy it would be best to create Function Panels for all of your exported functions. This allows Labview to pick the import library and makes the function definitions available to LabView.

If you need help on creating a DLL with a Function panel, let me know and I shall try and help further.

Its a bit of a pain to create the FP once you have the source code already done (which it sounds like you have), but its fairly easy...

Chris
0 Kudos
Message 2 of 7
(3,611 Views)
Chris,

Could you put together a small example of a DLL built in CVI that will work in Labviews? For "some" reason my exported functions are not being exposed properly and Labview continually displays a "broken arrow" when I link to the DLL.
0 Kudos
Message 3 of 7
(3,611 Views)
Did that help out at all ?
0 Kudos
Message 5 of 7
(3,611 Views)
Hi.

It's funny. I'm looking at your example as I look at the test DLL I made last week (that didn't work). They both appear to be the same, but the result is that yours works, and mine doesn't.
I tried making a new one from scratch, and it works fine now. I wonder if something with one of the saved files got corrupted.

W
0 Kudos
Message 6 of 7
(3,611 Views)
I've got to admit that my never worked first time either... Usually I use the preprocessor DLLEXPORT but for some reason that was causing errors on compile. (Its a basic thing that keeps biting me everynow and then and one day I will remember why). I changed it to __stdcall and it worked. Thats the usual place I fall over on.

Another trick I do is to place all exported function declarations in a seperate header file and use this to build the export library.

Anyway, glad you are all fixed up.

Chris
0 Kudos
Message 7 of 7
(3,611 Views)
Attached is a small CVI project that creates a DLL that takes a number and prints it to the StdIO window.
Also attached is a VI that calls the DLL and passes it a number...
No rocket science I am affraid but it should illustrate how you need to create the FP, source, export lists etc...

Just holla if you need any more ptrs...

Chris
0 Kudos
Message 4 of 7
(3,611 Views)