LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

linux compatibility, which functions are portable?

I've started on my very first CVI project and would appreciate some pointers regarding which functions are portable to Linux or not.

 

I understand that W32 API calls are taboo, that's a no-brainer but the NI guidelines are to program in pure "ANSI C".  What does this mean exactly?

 

Can i use Fmt and Scan functions and still expect theprogram to compile under windows?

 

I need VISA on Linux, so I'm assuming all VISA functions are portable?

 

 I'm a seasoned LabVIEW programmer but this is my first CVI project.

 

Shane.

0 Kudos
Message 1 of 11
(4,264 Views)
I've been using CVI for Linux full time for almost 2 years, so I'll try to
answer a few questions for you...

> I've started on my very first CVI project and would appreciate some
> pointers
> regarding which functions are portable to Linux or not. I understand
> that W32
> API calls are taboo, that's a no-brainer
Correct...

> but the NI guidelines are to program in pure "ANSI C". 
> What does this mean exactly? 
That you can use the standard C library, currently a mix of C89 and C99.
Some functions such as vsnprintf are missing... but they are also missing
from the normal CVI. Basically the entire set of functions you find in the
FPs provided with CVI will work, with a few bugs and caveats.

> Can i use Fmt and Scan functions and still expect theprogram to compile
> under
> windows? I need VISA on Linux, so I'm assuming all VISA functions are
> portable?  I'm a seasoned LabVIEW programmer but this is my
> first CVI
> project. Shane.
I don't know about Fmt and Scan but I expect they'll work.
Visa works, I've used it on one project; but the main reason I shifted
development to Linux is that I can write my own device drivers much more
simply than with Windows.

You can check the intalled libraries in the cvi linux directory.
Keep in mind that the compiler is actually gcc with some wrappers but that
is changeable.
Debugging is possible but not as convenient as with the CVI IDE.

I have some notes here: http://www.gdargaud.net/Hack/LabWindows.html#Linux
--
Guillaume Dargaud
http://www.gdargaud.net/


0 Kudos
Message 2 of 11
(4,248 Views)

Guilaume,

 

thanks for the info.  I just found out today that the RTE installs basically everything I'm using (Everything visible in a default installation of CVI).

 

I have installed no other libraries, so I suppose my program should be protable as-is?

 

Are there any specific conventions I need to adhere to to keep things portable?  What about DLLs, or shared libraries?  Can I create a shared library for Linux using the same source code for a Windows DLL if I use the DLLEXPORT macro?

 

Sorry for the noob questions, but I AM a n oob in this area.

 

Shane.

0 Kudos
Message 3 of 11
(4,247 Views)

Hi,

 

here you get a link about what you can do in CVI Linux: http://zone.ni.com/devzone/cda/tut/p/id/2823

In Linux, shared libraries are called "shared object" files and end in a ".so" extension. You can use the gcc compiler to create one.
Check out the following link:
http://www-106.ibm.com/developerworks/linux/library/l-dll.html?dwzone=linux

Or you will need to recompile your shared library in CVI Linux. Then you can call this shared library there.

Regards
DianaS
0 Kudos
Message 4 of 11
(4,222 Views)
> Guilaume, thanks for the info.  I just found out today that the
> RTE
> installs basically everything I'm using (Everything visible in a default
> installation of
> CVI). I have installed no other libraries, so I suppose my program
> should be
> protable as-is?
Yes, I find the portability one of the great advantages.

> Are there any specific conventions I need to adhere to to keep things
> portable?
Not particularly. I try to stick to ANSI C and standard CVI libraries. Some
of those libraries rely on Windows stuff and if you look in their code
you'll find lots of #ifdef _ni_linux_ to work around them. That's where the
missing functionalities or bugs are likely to be.
Keep in mind that the current RTE for Linux is 8.0, a full number behind the
Windows version, so some of the latest stuff may not work and you may not
even be aware of it (the RTE in Linux just ignores errors instead of
bringing a popup).

> What about DLLs, or shared libraries?  Can I create a shared library
> for Linux
> using the same source code for a Windows DLL if I use the DLLEXPORT macro?
You can certainly create a .so with the same code as your dll code. It's
been a while since I last created libraries for Linux, but all you may have
to do is put some empty #define DLLEXPORT
Then create you prog with
cvicc -debug -rebuild -lmyownlib MyProject.prj
--
Guillaume Dargaud
http://www.gdargaud.net/


0 Kudos
Message 5 of 11
(4,221 Views)

@DianaS,  which functionality can I use with gcc?  I was just reading up on this and it seems I need to buy a specific CVI compiler for Linux but if it can work witrh gcc (I'm not using any UI stuff) then that's cheaper of course.....

 

@Guillaume, thanks for the info.  I think I have enough information to be able to proceed with less fear now 🙂

 

Shane

0 Kudos
Message 6 of 11
(4,218 Views)

Hi Shane

 

if you order CVI for Linux http://sine.ni.com/nips/cds/view/p/lang/de/nid/203157 you have a lot of more functions and can easily develop a graphical user interface. Also you have included the libraries for our hardware (DAQmx, visa, gpib...)

Regards
DianaS
0 Kudos
Message 7 of 11
(4,213 Views)

Diana,

 

if all I need is VISA and ANSI C, can I compile the program using gcc?

 

The VISA installation on Linux copies all the header files needed for VISA right?

 

Shane.

0 Kudos
Message 8 of 11
(4,203 Views)

Hi,

 

I don't know if this will work and we don't support it. 

 

Regards
DianaS
0 Kudos
Message 9 of 11
(4,199 Views)

Hi Diana,

 

The second part is clear (no support) but it's the first part which would interest me since you've mentioned it in an earlier post.

 

Shane.

0 Kudos
Message 10 of 11
(4,197 Views)