LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Calling CVI DLL Function from Visual Studio

HI all ,

 

Iv'e created a DLL using CVI and i'm tring to call one of it's function from visual studio 6.0

 

I'm getting a general error , is there a specific prototype that i need to set my functions in ordrer to call them ?!  

-----------------------------------------
Kobi Kalif
Software Engineer

0 Kudos
Message 1 of 4
(3,138 Views)

Do i need the CVI RTE in order to use the DLL from visual studio ?

-----------------------------------------
Kobi Kalif
Software Engineer

0 Kudos
Message 2 of 4
(3,131 Views)

You will need to distribute the CVI RTE along with your DLL, since anything you write in CVI is going to use the RTE.

 

As far as calling the DLL functions, you can use the CVI defined macros

 

<return type> DLLEXPORT DLLSTDCALL <function name> (<param1 type> <param1> ...) {

 

}

 

to declare your functions in the DLL for access by a VS application.

 

for example

 

int DLLEXPORT DLLSTDCALL myfunction (int funparam1, double func param2) {

 

}

 

There are options for identifying which functions to export from your DLL, I use "functions marked for export" but there are other choices available.  I also include a type library so when you type the name of a DLL funciton in VS6 you see a balloon popup with the function signature.  This is a check box in the target settings.  You have to create a ".fp" file (function panel file) to collect the function info for the library.

 

From VB6 you can access the DLL a couple of ways, but I usually add the DLL as a reference.

Message 3 of 4
(3,119 Views)

And as a follow up, unless your DLL is an ActiveX container (I've never made a DLL of this type with CVI though it may be possible) do not try and register it with the Windows OS (e.g. don't double click the DLL file to launch regsvr32) or it will make a mess in the registry, that will be difficult to repair if you ever need to change or replace the DLL - it'll be impossible to remove the DLL reference from your VS6 project without going into the registry and ripping out all the DLL registration stuff (that wasn't relevant in the first place).

 

Most DLL's created within the VS environment tend to be ActiveX DLL's, and users often habitually double click these to register them so that the OS knows where to find the components they contain.  You don't want to do this with a "non-Active" DLL, it can be a real hassle to undo.

 

 

0 Kudos
Message 4 of 4
(3,092 Views)