Noob using Labview_DLL
-
- Posts: 20
- Joined: Mon Jun 21, 2010 3:27 pm
- Location: Karlskrona
Noob using Labview_DLL
Please if you can help me with this.
I just patched Biosemi to my laptop, installed drivers and downloaded ActiView604-Light, but there is only [b]Labview_dll.dll[/b] withouth header .h or library .lib
So I have written dynamic dll loading, please tell me if I'm doing something wrong here.
[code]#include <stdio>
#include <stdlib>
#include <time>
#include <windows>
#include <conio>
#include <string>
// DLL function signature
typedef HANDLE (*OPEN_DRIVER_ASYNC)(void);
int main (void) {
HANDLE usbHandle;
OPEN_DRIVER_ASYNC opendriver;
HINSTANCE hinstLib = LoadLibrary(TEXT("Labview_dll.dll"));
if (hinstLib == NULL) {
printf("ERROR: unable to load DLL\n");
return 1;
}
// Get function pointer
opendriver = (OPEN_DRIVER_ASYNC)GetProcAddress(hinstLib, "OPEN_DRIVER_ASYNC");
if (opendriver == NULL) {
printf("ERROR: unable to find DLL function\n");
FreeLibrary(hinstLib);
return 1;
}
// Call function.
usbHandle = opendriver();
// Unload DLL file
FreeLibrary(hinstLib);
// Display result
printf("The End.\n");
return 0;
}
[/code]
I just patched Biosemi to my laptop, installed drivers and downloaded ActiView604-Light, but there is only [b]Labview_dll.dll[/b] withouth header .h or library .lib
So I have written dynamic dll loading, please tell me if I'm doing something wrong here.
[code]#include <stdio>
#include <stdlib>
#include <time>
#include <windows>
#include <conio>
#include <string>
// DLL function signature
typedef HANDLE (*OPEN_DRIVER_ASYNC)(void);
int main (void) {
HANDLE usbHandle;
OPEN_DRIVER_ASYNC opendriver;
HINSTANCE hinstLib = LoadLibrary(TEXT("Labview_dll.dll"));
if (hinstLib == NULL) {
printf("ERROR: unable to load DLL\n");
return 1;
}
// Get function pointer
opendriver = (OPEN_DRIVER_ASYNC)GetProcAddress(hinstLib, "OPEN_DRIVER_ASYNC");
if (opendriver == NULL) {
printf("ERROR: unable to find DLL function\n");
FreeLibrary(hinstLib);
return 1;
}
// Call function.
usbHandle = opendriver();
// Unload DLL file
FreeLibrary(hinstLib);
// Display result
printf("The End.\n");
return 0;
}
[/code]
-
- Posts: 20
- Joined: Mon Jun 21, 2010 3:27 pm
- Location: Karlskrona
-
- Posts: 20
- Joined: Mon Jun 21, 2010 3:27 pm
- Location: Karlskrona
OK, I found header, lib and dll, wrote this simple example, but am I forgetting something here o_O
It doesn't want to compile and whines about:
error LNK2019: unresolved external symbol __imp__OPEN_DRIVER_ASYNC referenced in function _main
fatal error LNK1120: 1 unresolved externals
[code]
#include <stdio>
#include <stdlib>
#include <time>
#include <windows>
#include <conio>
#include <string>
#include "labview_dll.h"
__declspec(dllimport) HANDLE OPEN_DRIVER_ASYNC(void);
int main (void) {
HANDLE usbHandle;
usbHandle = OPEN_DRIVER_ASYNC();
return 0;
}
[/code]
It doesn't want to compile and whines about:
error LNK2019: unresolved external symbol __imp__OPEN_DRIVER_ASYNC referenced in function _main
fatal error LNK1120: 1 unresolved externals
[code]
#include <stdio>
#include <stdlib>
#include <time>
#include <windows>
#include <conio>
#include <string>
#include "labview_dll.h"
__declspec(dllimport) HANDLE OPEN_DRIVER_ASYNC(void);
int main (void) {
HANDLE usbHandle;
usbHandle = OPEN_DRIVER_ASYNC();
return 0;
}
[/code]
-
- Posts: 20
- Joined: Mon Jun 21, 2010 3:27 pm
- Location: Karlskrona
[quote="pmac"]Happ,
It looks like the linker doesn't have the labview_dll.dll file.
Do you include it explicitly as a library to be searched?
Paul[/quote]
I have been at this for a while now and I keep getting the same error message over and over again, does anybody know how to do this in Visual Studio 2008?
It looks like the linker doesn't have the labview_dll.dll file.
Do you include it explicitly as a library to be searched?
Paul[/quote]
I have been at this for a while now and I keep getting the same error message over and over again, does anybody know how to do this in Visual Studio 2008?
Happ,
I don't often use Visual Studio.
Have you tried something like this:
http://www.learncpp.com/cpp-tutorial/a2 ... 5-express/
Paul
I don't often use Visual Studio.
Have you tried something like this:
http://www.learncpp.com/cpp-tutorial/a2 ... 5-express/
Paul
-
- Posts: 20
- Joined: Mon Jun 21, 2010 3:27 pm
- Location: Karlskrona
Hi Happ,
I downloaded Visual C++ 2008 and created a new project.
I added your above code as source file "main.cpp".
In Project->Properties->Configuration Properties->C/C++->General, item "Additional Include Directories"
I added: c:\...\developers kit\c-code (... is whatever is needed on your system to point to the downloaded labview_dll.h file).
In Project->Properties->Configuration Properties->Linker->General, item "Additional Library Directories"
I added: c:\...\developers kit\c-code (... is as above but for the labview_dll.lib file).
I put a copy of Labview_DLL.dll in the same directory as the main.cpp file created above.
I added a ".h" to each of the standard include lines in main.cpp so for instance,
#include <stdio> becomes #include <stdio>
Now your program compiles and runs.
You can harvest code from labview_dll_synctest.cpp to make your acquisition stream data into the ring buffer.
Paul
I downloaded Visual C++ 2008 and created a new project.
I added your above code as source file "main.cpp".
In Project->Properties->Configuration Properties->C/C++->General, item "Additional Include Directories"
I added: c:\...\developers kit\c-code (... is whatever is needed on your system to point to the downloaded labview_dll.h file).
In Project->Properties->Configuration Properties->Linker->General, item "Additional Library Directories"
I added: c:\...\developers kit\c-code (... is as above but for the labview_dll.lib file).
I put a copy of Labview_DLL.dll in the same directory as the main.cpp file created above.
I added a ".h" to each of the standard include lines in main.cpp so for instance,
#include <stdio> becomes #include <stdio>
Now your program compiles and runs.
You can harvest code from labview_dll_synctest.cpp to make your acquisition stream data into the ring buffer.
Paul
-
- Posts: 20
- Joined: Mon Jun 21, 2010 3:27 pm
- Location: Karlskrona
Thank you for the help.
Yeah, the ".h" part gets cut of constantly, but I got it.
The thing is, I tried all of the steps stated in your last post but i still couldn't compile. So I asked my very good programming friend and he couldn't do it too, like ".lib" doesn't have all the function definitions.
Can you please "zip" the MS Visual Project, the last one discussed that worked and RapidShare it or somehow else give it to me please.
Damn this frustrates me.
Yeah, the ".h" part gets cut of constantly, but I got it.
The thing is, I tried all of the steps stated in your last post but i still couldn't compile. So I asked my very good programming friend and he couldn't do it too, like ".lib" doesn't have all the function definitions.
Can you please "zip" the MS Visual Project, the last one discussed that worked and RapidShare it or somehow else give it to me please.
Damn this frustrates me.
-
- Posts: 20
- Joined: Mon Jun 21, 2010 3:27 pm
- Location: Karlskrona
OK, I forgot to mention my system is Windows7 64bit, and as such I downloaded the Win7 64bit version of the drivers, and they couldn't compile no matter how much I tried.
Then I downloaded 32bit version and voila, it compiled like a charm.
Has anybody had the same problem? Seams like a problem in the ".lib" file. Should I contact BioSemi guys about this?
Still, I have to test are my drivers now compatible with this dll version, I somehow doubt it referencing to main Murphys Law.
Then I downloaded 32bit version and voila, it compiled like a charm.
Has anybody had the same problem? Seams like a problem in the ".lib" file. Should I contact BioSemi guys about this?
Still, I have to test are my drivers now compatible with this dll version, I somehow doubt it referencing to main Murphys Law.
According to the following Microsoft page, the Express edition is 32 bits only:
http://msdn.microsoft.com/en-us/library ... S.90).aspx
You can use 32 bit applications on 64 bit Windows but be careful ...
install the 64 bit driver package from BioSemi to get the correct WinUsb driver installed then for development with Microsoft's Visual Studio Express use the labview_dll.lib and labview_dll.dll from the 32 bit BioSemi package.
Paul
http://msdn.microsoft.com/en-us/library ... S.90).aspx
You can use 32 bit applications on 64 bit Windows but be careful ...
install the 64 bit driver package from BioSemi to get the correct WinUsb driver installed then for development with Microsoft's Visual Studio Express use the labview_dll.lib and labview_dll.dll from the 32 bit BioSemi package.
Paul
-
- Posts: 20
- Joined: Mon Jun 21, 2010 3:27 pm
- Location: Karlskrona
Tnx, I did exactly that.
But i have MS Visual Studio 2008 Professional Edition so there should be no problem there.
I successfully ran the program and didn't receive any error.
Now I have to get the GSR data and analyze it to use it in the game. Please can you point me in this direction (post, thread, blog).
But i have MS Visual Studio 2008 Professional Edition so there should be no problem there.
I successfully ran the program and didn't receive any error.
Now I have to get the GSR data and analyze it to use it in the game. Please can you point me in this direction (post, thread, blog).
For C, you can lift some code from the test program labview_dll_synctest.cpp in the C-code subdirectory of the BioSemi driver package.
There was this recent discussion:
viewtopic.php?t=452
Or consider something built on:
http://www.biosemi.com/download/ActiView604-Light.zip
Paul
There was this recent discussion:
viewtopic.php?t=452
Or consider something built on:
http://www.biosemi.com/download/ActiView604-Light.zip
Paul