Jump to content

As of July 17, 2015, the LabJack forums here at forums.labjack.com are shut down. New registrations, topics, and replies are disabled. All forums are in a read-only state for archive purposes.

Please visit our current forums at labjack.com/forums to view and make new posts. To post on the current forums, use your labjack.com login account. Your old LabJack forums login credentials have been retired. There are no longer separate logins for labjack.com and LabJack forums.


Photo

U3-LV + Win7 + Cygwin + gcc support?


  • Please log in to reply
3 replies to this topic

#1 LabCo

LabCo
  • Members
  • 6 posts

Posted 27 March 2013 - 11:59 AM

I have the following setup: Dell OptiPlex PC, Windows 7, Cygwin, gcc v4.5.3, LabJack U3-LV Is there documentation for controlling the LabJack with a C99 program compiled with gcc in a Cygwin environment?

#2 LabJack Support

LabJack Support
  • Admin
  • 8677 posts

Posted 27 March 2013 - 12:50 PM

Take a look on the U3 quick start for a general Windows start guide:

http://labjack.com/support/u3

We do not provide Cygwin specific documentation, but you can use dynamic linking to access functions from the Windows UD driver. We provide examples of this here:

http://labjack.com/s.../examples/dev-c

In the U3 example, for Windows 7 you will need to modify this include:

#include "c:\program files\labjack\drivers\LabJackUD.h"

to:

#include "C:\Program Files (x86)\LabJack\Drivers\LabJackUD.h"

In the example's directory you can compile it with the following command in a Cygwin terminal:

gcc -o U3_Simple.exe main.cpp

For more UD driver and C examples look at the VC6 examples:

http://labjack.com/s...ud/examples/vc6

Section 4 of the U3 User's Guide provide UD driver documentation:

http://labjack.com/s...3/users-guide/4

#3 LabCo

LabCo
  • Members
  • 6 posts

Posted 27 March 2013 - 01:54 PM

Thanks! That does work fine.

The only problem is that I wish the dynamic linking header file and setup functions were more "C" than "C++". I'm teaching a C programming course, and I wanted students to be able to use gcc as a straight C90 or C99 compiler (i.e.. gcc -std=C90 or -std=C99 does not work).

It's still OK, but now I'll have to tell them not to get tempted and use other convenient C++ features :-)


Take a look on the U3 quick start for a general Windows start guide:

http://labjack.com/support/u3

We do not provide Cygwin specific documentation, but you can use dynamic linking to access functions from the Windows UD driver. We provide examples of this here:

http://labjack.com/s.../examples/dev-c

In the U3 example, for Windows 7 you will need to modify this include:

#include "c:\program files\labjack\drivers\LabJackUD.h"

to:

#include "C:\Program Files (x86)\LabJack\Drivers\LabJackUD.h"

In the example's directory you can compile it withthe following command in a Cygwin terminal:

gcc -o U3_Simple.exe main.cpp

For more UD driver and C examples look at the VC6 examples:

http://labjack.com/s...ud/examples/vc6

Section 4 of the U3 User's Guide provide UD driver documentation:

http://labjack.com/s...3/users-guide/4



#4 LabJack Support

LabJack Support
  • Admin
  • 8677 posts

Posted 27 March 2013 - 03:51 PM

The LJUD_DynamicLinking.h header should be good with C. In the U3_Simple's main.c file, in the LoadLabJackUD function when getting the pointers/addresses to the UD driver functions you can use casts that are C friendly instead. For example, instead of: m_pListAll = (tListAll)::GetProcAddress(hDLLInstance,"ListAll"); use: m_pListAll = (tListAll)GetProcAddress(hDLLInstance,"ListAll");


0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users