LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Is it viable to preduce a dll from cyapi.lib which is cmpiled by c++ that can called by labview?

Solved!
Go to solution

Now I 'm tring to  make a dll through cyapi.lib,so that labview can call the function for conneting usb device(cy68013 produced by cypress company),but i am not sure this way is viable.
this my simple code of translate cyapi.lib to cyapi.dll:
#include "typedef.h"   
#include "CyAPI.h"  
#pragma comment(lib,"CyAPI.lib")

extern bool _declspec(dllexport) Open_0(void);

CCyUSBDevice *USBDevice=new CCyUSBDevice();

bool Open_0()
{

 return USBDevice->Open(0);   //get a funtion that can open device 0
}
the link error is  this:
Compiling...
CyAPI.cpp
Linking...
   Creating library Debug/MainDLL.lib and object Debug/MainDLL.exp
CyAPI.lib(CyAPI.obj) : error LNK2001: unresolved external symbol ___security_cookie
CyAPI.lib(CyAPI.obj) : error LNK2001: unresolved external symbol @__security_check_cookie@4
CyAPI.lib(CyAPI.obj) : error LNK2001: unresolved external symbol ___CxxFrameHandler3
CyAPI.lib(CyAPI.obj) : error LNK2001: unresolved external symbol __EH_epilog3
CyAPI.lib(CyAPI.obj) : error LNK2001: unresolved external symbol __EH_prolog3
CyAPI.lib(CyAPI.obj) : error LNK2001: unresolved external symbol __EH_epilog3_GS
CyAPI.lib(CyAPI.obj) : error LNK2001: unresolved external symbol __EH_prolog3_GS

my guess maybe the reason is Ihaven't initialize all the variable used in the cyapi.lib or there are something wrong in VC develop enviroment.

 

Does anyone can help me?

0 Kudos
Message 1 of 5
(5,454 Views)

Technically, this isn't even a LabVIEW question, so your question would be better asked over at the Cypress forums. A Google search yielded this cached forum post, which does not seem to be available anymore on the "live" forum.

 

Are you sure you're supposed to be using cyapi.lib? I would expect a vendor like Cypress to provide a ready-made DLL to call from Windows.

0 Kudos
Message 2 of 5
(5,442 Views)

I'm just not sure this way will success.Maybe it is possible to make it but will cost a lot time to solve the problem.

Cypress provide another way for developor ,cyapi.dll,but which is  compiled by C#.My lV is 8.5 version and I'm not fimilar with C#,so I have to find a effective way to shorten the development time.

Think for your replay,and I expect for my suggestion.

0 Kudos
Message 3 of 5
(5,428 Views)
Solution
Accepted by KyleJoe
If it's compiled with C# then it's a .NET assembly. To use it, you just use the .NET functions in LabVIEW. You should have received some example programs with it. Essentially you need to do the same thing the example program does, but you use the LabVIEW .NET functions to do it. There are examples that ship with LabVIEW on how to use .NET. In most cases it's easier to use than to try to call a "regular" DLL.
0 Kudos
Message 4 of 5
(5,422 Views)
To answer the original problem sort of: You need to link with the correct C runtime library too. Seeing the missing imports I wonder if the lib file was created with Visual C at all. Trying to link link libraries with a different compiler than it was created with is a sure way to run into unsolvable roundabout problems.
Rolf Kalbermatter  My Blog
DEMO, Electronic and Mechanical Support department, room 36.LB00.390
0 Kudos
Message 5 of 5
(5,389 Views)