LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

problems with external dll

I everybody,

I'm trying to control an instrument (Bayspec wavecapture, FBG interrogator) by means of Labwindows 9.0. I have the SDK provided from Bayspec, which consists of a library .lib file, a .dll file and an header .h file. I added the .lib and .h files to the project, put the .dll file in the same project directory, and write a minimal code to try to open and close the device. After compilation I received a lot of errors, some of that I solved "empirically": problems with the types WORD, BYTE, LPCSTR, which I solved by adding into the header file:

#define WORD int
#define BYTE char
#define LPCSTR const char (but probably should be const char*)

 

function missing prototypes error, which I solved by specifing into the function definition the void type, i.e.:

DLL_PORT_TYPE    BOOL  DLL_PORT_FUNCTION_TYPE DLL_Open_Device(void);

instead of

DLL_PORT_TYPE    BOOL  DLL_PORT_FUNCTION_TYPE DLL_Open_Device();

 

After that I was able to compile without any error or warning, but when I build everything I have the following project link error:

Undefined symbol '_DLL_Open_Device@0' referenced in "bayspec_2.c".

I suppose the dll was realized with/for visual c++ 6.

 

The first lines of the .h file are the following:

#ifndef _Sense2020DLL_
#define _Sense2020DLL_

//difine the export type
#define DLL_PORT_TYPE __declspec(dllexport)
#define DLL_PORT_FUNCTION_TYPE __stdcall    //this can be used in visual basic program

 

I feel that in that lines could be located the problem, but I'm a newbie programmer.

 

Thanks a lot if you can help me and sorry if the solution was into the official documentation because I was unable to found it.

Cosimo

0 Kudos
Message 1 of 5
(3,218 Views)

Hey Cosimo,

 

Did you take a look to this document?

 

"Undefined Symbol" When Building a Stand-alone Executable in LabWindows/CVI

 

Let me know if it works.

Best regards

Matteo
0 Kudos
Message 2 of 5
(3,187 Views)

Thank you Matteo,

I looked at the target settings (Labwindows 9.0) but the Run-time support is set to Full run-time engine. I try to check the "Enable load external module" option too, but it didn't work. A strange think because I can open the same Dll in Labview without any problem. I look inside the dll with dependency walker and I see all the functions. I solved all the problems with the definitions into the header file by adding windows.h, but not more.

I will live with the idea of work with Labview!?

 

Thanks again for your kind answer,

 

Cosimo

0 Kudos
Message 3 of 5
(3,177 Views)

For my research work, can any body share me the files .dll, .lib, .h given by BAYSPEC. If anybody does this, I will be greatfull to him forever.

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

Hi Badal,

I would suggest to you to open a new thread on the NI Forum. This would allow you to submit your topic to a very large community instead of continuing an old post with very low visibility. By the way a took a look on the instrument driver network and I din't get any feedback about the istrument you are looking for. So it might be useful for you to ask to the Bayspec if they provide for some LabWindows/CVI(?) instrument driver.

Good luck for your search and have a great day.

Matteo
0 Kudos
Message 5 of 5
(2,894 Views)