LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

DLL Generation with type library

I'm trying to generate a DLL with a type library for use with teststand...
Basically I have a whole series of activeX/com components that I can create 'instrument' libraries for using the activeX controller wizard.. I can call these libraries from CVI no problem, and everything works as expected. The next step would be to call the same methods from within teststand, and rather than have to write wrappers in CVI to take the teststand CVI adapter parameters, I'd like to make each of these libraries into DLL's that the TS DLL adapter can access. I want to include the type library in the DLL so that TS can pull out the parameters...
If I try and create the dll, it errors when creating the TLB file. manually running the OD
L file through mktyplib.exe show that CVI is adding some variable definitions that are defined elsewhere, so after removing them and generally hacking the odl around a bit, I can get the tlb file ok... However, I'm now at a loss... how do I get CVI to not try and generate it's own tlb & odl files again when I create the dll?
(btw I'm also using cvi 6.0 beta in case that complicates matters)
0 Kudos
Message 1 of 6
(3,873 Views)
Unfortunately, there isn't a way to keep CVI from regenerating the type library files. What you would need to do is take out the variable or data type definitions that are causing the problem from the FP file. They can still be in your program, but not in the FP file. We use the FP file to generate the type library info, so if you remove it there it will fix the problem.

Best Regards,

Chris Matthews
Measurement Studio Support Manager
0 Kudos
Message 2 of 6
(3,873 Views)
Hi,

i too faced the same problem which was explained above. I have removed all the CVI created data types. But still the dll couldn't be created. I have attached the odl file. I am new to CVI environment and don't know exactly how to correct the odl file. Please help me to sort out this problem.

Sasi
0 Kudos
Message 3 of 6
(3,873 Views)
I have the same issue with the ODL file.
I have removed all the defined variable types from the FP file and use the menu option from the FP to generate the OLD file (Options->Generate ODL File...). I can then run this ODL file with the MkTypLib.exe and it will successfully generate the TLB file.
However when I try and build my DLL using the FP as the type library it seams to re-create the ODL file with the old type info. I then get the error that there was an error with the ODL file and it fails to create the DLL.
The strange thing here is that I can make the ODL file read only and it still errors before it tries to update the file.
For background info on my project I have chosen to use a header file for the exported functions rather than
marking each function for export.
Any ideas?
0 Kudos
Message 4 of 6
(3,873 Views)
Hi,
I somehow tried few and got my dll creation successful. Let me explain the steps which I have undertaken. Hope it will help you.

1. Whichever data types the odl couldn�t recognize, please remove it from FP and replace them with appropriate data type it refers (example HRESULT à Long)
2. This procedure is not valid for structures. (If it is a structure, please let me know.)
3. Now replace the custom defined data type in .c and in .h files, which you have removed from FP, with the same data type you referred before in FP. If you have replaced HRESULT with long. Replace HRESULT with long in both .c and in .h files.
4. Do the same procedure for all the custom data types which give error in odl. Now you build the dll, this should create the dll.
Hope
this works!
0 Kudos
Message 5 of 6
(3,873 Views)
Thanks for the info, unfortunately the types I am having difficulty with are structures.
I think the only way I am going to resolve this issue is to change my code to use void * as data type for the functions than cast the data inside the function to the actual type.
I does seam rather strange that I can successfully create the odl and tlb file when I use the generate option from the FP editor, but not when I build the DLL.
0 Kudos
Message 6 of 6
(3,873 Views)