VM110 - VC++ 2010 Express library linker error

Dear Madam or Sir,

I recently purchased a VM110 USB experiment interface board from Velleman.
I would like to control the card via Igor Pro, a scientific data collection and analysis tool.
To control equipment with Igor I have to create an external operational file (.xop) and I am usually doing this using Visual C++ 2010 Express. I am not doing this very often and so my C++ code skills are not that great. I studied your example code and tried to write my little program. The code compiles fine but I get the following linker error:

Creating library C:\Equipment\Software\ALD_program\Debug\ALD_valve_control.lib and object C:\Equipment\Software\ALD_program\Debug\ALD_valve_control.exp
ALD_valve_control.obj : error LNK2019: unresolved external symbol __imp__OpenDevice referenced in function “int __cdecl ALD_valves_Init(struct ALD_valve_control_NoParams *)” (?ALD_valves_Init@@YAHPAUALD_valve_control_NoParams@@@Z)
1>ALD_valve_control.xop : fatal error LNK1120: 1 unresolved externals

I included the K8055D_C.lib in my project but it seems like the functions in the K8055D.DLL can not be accessed in the linking process. If I include the k8055d.lib file instead I get the error message

k8055d.lib : fatal error LNK1136: invalid or corrupt file.

Here is the relevant code in my header file:

#define K8055_App __declspec(dllimport)
#ifdef __cplusplus // C++
extern “C” {
#endif
K8055_App long OpenDevice(long CardAddress);

#ifdef __cplusplus
}
#endif

And the relevant piece of code from my source file:

#include “XOPStructureAlignmentTwoByte.h” // All structures passed to Igor are two-byte aligned
struct ALD_valve_control_NoParams {
double result;
};
typedef struct ALD_valve_control_NoParams ALD_valve_control_NoParams;
#include “XOPStructureAlignmentReset.h”

static int
ALD_valves_Init(ALD_valve_control_NoParams* p)
{
int err = 0;
k8055d:OpenDevice(3);
p->result=err;
return 0;
}

I can compile and run the example codes from Velleman but I have problems with linking the dll functions in my code. Taking this into account I assume that I am just not calling the functions correctly but I am not sure where I am doing it wrong.
I would very much appreciate your advice on this.

Thank you,
Mathias

[quote]I included the K8055D_C.lib in my project but it seems like the functions in the K8055D.DLL can not be accessed in the linking process.[/quote] The K8055D_C.lib can be used only with the K8055D_C.DLL.

[quote]If I include the k8055d.lib file instead I get the error message k8055d.lib : fatal error LNK1136: invalid or corrupt file. [/quote]The k8055d.lib file in the example package and on the CD is only for Borland C++Builder. It can’t be used with Mocrosoft software.

Please download the latest software package.

There is an example how you can use the new K8055D.DLL in Microsoft Visual C++ compiler without the .lib file.

Here is the link to the download page:
velleman.eu/distributor/supp … code=K8055
Download the: “Complete SDK Pack (Rev 4.0)”.

The package includes new K8055D.DLL and sample projects written in various programming languages.
Please read the “README.TXT” and the “K8055 & VM110 Getting Started.pdf”.

Dear VEL255,

With your tips, I figured out how to implement the VM110 experiment board software for control in Igor Pro using K8055D_C.lib and K8055D_C.DLL.

Thank you for your help!