03-12-2012 05:08 PM
Hi- I've searched the board and don't see a reference to this. At least I've tried not to duplicate a previous question... 🙂
I am updating a measurement app that is developed with CVI 8.1.
All previous instrument comms have used GPIB.
App works beautifully, but needs an upgrade on an instrument.
The owner of the app now wants to add a USB comms device, a Giga-tronics 8888-A.
http://www.gigatronics.com/product/c/GT-8888A-USB-Power-Sensor
The device comes with the necessary .dll, .lib and .h.
However, if I attempt a static link the linker cannot find the function calls.
Next I attempted a dynamic link and successful loaded the .lib, but again the function could not be found.
In that case LoadExternalModule (pathname) was successful, but GetExternalModuleAddr (module_id, funname, &status)
returned an error. (yes, I checked spelling).
Has anyone had these problems before?
What are the typical problems I should look for with 3rd part libs?
Any typical "Fixes" to recommend?
Thank you.
//
03-13-2012 03:58 AM
I generally find myself doing this on 3rd party libraries to be able to use them properly.
From what you have described, it looks like it will solve your problem of static linking.
03-13-2012 09:33 AM
Hi- thanks for the tip. Reading through the description I am curious- is the lib file created based on scanning and interpreting the include file, or based on reading and interpreting the DLL file?
03-13-2012 05:21 PM
@ ebalci - thank you for the help. This has started me down the correct path-
One new question is that the "generate dll import library" now barks at this line:
GTPM_API STATUS __stdcall GTPM_GetExtendedAveraging(unsigned long instrumentHandle, BOOLEAN *pEnabled, long *pExtAveraging);
with the error "missing parameter type".
It does not understand the BOOLEAN type. I understand the c does not have this type, so how do we ensure that the "generate dll import library" knows this type?
Since this is a third party .h, .lib and .DLL then maybe I am left to contacting giga-tronics and getting support from them. Thanks again for the help.
03-14-2012 01:52 PM
Could you direct us to where the dll, .h and lib file can be found or post it here? BOOLEAN is probably a typedef and not the standard bool type, which C doesn't have.
03-14-2012 03:04 PM
Hi-
thank you for the offer to look at this.
Attached are the three files- .h, .lib & .dll, and also the "programming manual" from Giga-tronics.
Any guidance is greatly appreciated.
03-14-2012 03:30 PM
I get the following error when trying to generate a DLL import library:
Error: Unable to create import library. Error in header file at line 189, column 5: Syntax error; found ‘identifier’ expecting ‘}’.
Did you get this error at any point?
03-14-2012 03:39 PM
if I recall I think that was due to the formating of the enum & struct statements in the header file. Is that line number on one of the "enum" or "struct" declarations?
I believe that is due to strict adherance to "c".
Had to reformat all enums to read as so the cmopiler would understand them
they were originally
enum FRUIT
{
apple,
pear
} ;
had to change them to
typedef enum
{
apple,
pear
} FRUIT;
03-14-2012 04:38 PM
I was able to successful build the library by adding the following to the header file:
1. typedef int BOOLEAN;
* You may want to add #define for true and false.
2. struct before every struct in the function prototypes.
03-14-2012 05:30 PM
Hi Rohama - thank you . Can you take the next step to see if you can actually call any of the functions from the DLL? That final step, successfully calling the functions, is where I am now tripping up. Not sure why...
// thank you.