10-07-2010 01:01 PM
When using the database functions (for example, DBError) in a dll file called from MS Visual Studio, I get linking errors because the functions are not found. I copied the header file for the functions into the project that is compiled to a dll, but this did not help.
What options do I need to set in the project properties? Or how do I fix this?
Thanks!
10-07-2010 05:02 PM
In general, you need to compile the client code (the code calling the dll functions) using the header file that defines the functions in the DLL, and you have to link to the DLL using the .lib file that contains the "glue" code that invokes the dll function, fixes up paramter and return types, etc.) The header file and .lib file are generated when you create the DLL. It sounds like you're using a DLL created in CVI? When you set the module type as DLL, CVI generates the .h and .lib files mentioned. You also have to make sure the same calling convention is used, usually stdcall.
Of course, there are exceptions to all of this.
But, the most common way of invoking a dll function requires the above compile / link steps.
There's a white paper / tutorial on this site on how to build and use DLLs.
Menchar
10-12-2010 10:10 AM
I added cvi_db.h to the project that is compiled to a dll, and modified the function declaration to include the _declspecl (I'm probably not spelling this correctly) terminology. This did not help.
The functions I created are able to be accessed via the dll.
The functions provided by Labwindows, such as DBErrorMessage, are causing the problem.
How do I provide access to Labwindows functions through a dll? Specifically those in the 'database connectivity toolkit' ?
Thanks!
10-13-2010 01:51 PM
Hi coolGal,
Here are two documents which walk through two different approaches for accessing CVI functions from Visual Studio:
DevZone: How to Integrate 32-Bit LabWindows/CVI 4.0 Libraries into Microsoft Visual C/C++ or Borland...
KnowledgeBase: Integrating LabWindows/CVI with Microsoft Visual C++
Best Regards,
John M
10-13-2010 02:26 PM
John,
Thanks for the links . . . We did indeed use the method of "The LabWindows/CVI Project Wizard creates a Visual C++ project that uses the LabWindows/CVI run-time libraries" and then also "Option 1. Define the user interface callback functions in the external third-party compiler"
This works great.
Until I added the 'database connectivity toolkit' and tried to access things like DBErrorMessage. This does not link in MS Visual Studio.
What do I modify to get the MS Visual Studio project to include the database connectivity toolkit? What files actually make up this 'toolkit'?
10-14-2010 04:25 PM
Hi coolGal,
Please try the following:
For me, this builds and links successfully with CVI 2009 and Visual Studio 2008. What versions of CVI, Visual Studio, and the SQL Toolkit are you using? Also, what operating system are you on?
Best,
John M