LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Creating a .NET wrapper for a DLL with a FP file

Solved!
Go to solution

I am trying to create a .NET wrapper for a DLL that I created in CVI. The DLL has a FP file that was created from comments in the header file. I am trying to use the Instrument Driver Wizard:

https://www.ni.com/docs/en-US/bundle/labwindows-cvi/page/iddh/using_the_instrument_driver_developmen...

When doing so I get a error message after selecting the .fp file that says "Instrument prefix missing from within the function panel (.fp) file. To continue generation, modify the file to contain the prefix."

 

The DLL is not an instrument driver, so it could be a bit of a stretch to be using the Instrument Driver Wizard, but it seems that with it being a DLL that has a function panel file it should all be the same. Is it possible to use the Instrument Driver Wizard with DLLs that are not strictly an instrument driver?

 

If it is possible, how do I get the instrument prefix into the .fp file? I do not see anything that allows me to specify the instrument prefix as part of the comments in the header file. During the conversion to a .fp file you can specify a few options. One of them is Function Prefix, but I am already specifying that so the instrument prefix must be something else. I am therefore guessing that editing the .fp file is what is needed, but I don't see any option for setting the instrument prefix when I open the .fp file for editing in CVI.

 

- Carl

0 Kudos
Message 1 of 5
(4,550 Views)

 

Hello, 

 

I think you can call the functions implemented in the Dll without using the Wizard: MSDN: Consuming Unmanaged DLL Functions

 

 

0 Kudos
Message 2 of 5
(4,535 Views)

Thanks. I was aware of the option of using PInvoke. However there are many functions in the DLL so I was hoping to avoid some work by using something that was automated. Since I had already created a .fp file for the DLL it seemed like the wizard would be able to do the job for me.

 

Carl

0 Kudos
Message 3 of 5
(4,529 Views)
Solution
Accepted by topic author Carl_Prevas

This may be a bit late, but yes you can use the Instrument Driver Wizard to convert a CVI .fp to a .NET wrapper. In CVI, instrument driver is just a term used to describe a DLL with an accompanying .fp file.

 

I created a DLL and a function panel for it and was able to recreate the error you received by not providing a prefix for the function panel. The prefix corresponds to an actual prefix in your DLL, so if you don't have a prefix in your DLL, that could be a problem. Open up the .fp file and right-click the top level node and choose Edit Node. This is where you can specify the prefix that the Instrument Driver Wizard is looking for. For an example, here is the .fp and code for my library:

 

FP.JPG

 

FP2.JPG

National Instruments
Message 4 of 5
(4,503 Views)

Never too late.

 

I was not able to get to the Edit Node menu item since the .fp file was locked by source code control. It wasn't very clear that the reason for the menu item being greyed out was that it was read-only.  Once I checked out the file (and reloaded the project) then I could edit the root node.

 

Thanks for the help,

Carl

0 Kudos
Message 5 of 5
(4,484 Views)