Re: Writing C programs for Labview RT



I've compiled DLLs to run on NI's own hardware (fieldpoint, RIO). Some
thoughts that might help:

Also the hardware I used had an extremely small stack, didn't specify the
stack size, and gave no indication of overflow besides crashing. You'll need
to specify almost everything static or global to conserve space.

Don't even think about using a compiler other than CVI. Visual Studio and
GCC (with mingw) "should" work, but both generate a lot of imports that are
not supported. In my case VS was trying to check the codepage, which was
unsupported and I couldn't disable. MinGW had some problem with atom tables.
Only CVI 7.1 worked right.

Beware, if your DLL ethernet only winsock 1.1 is supported. You'd have to
remove winsock 2.0 features. The RT system is only compatbile with a subset
of the win32 api, so you'll run into many similar problems

Use the DLL Checker tool provided on NI's website to verify that your DLL is
importing legal functions. There is no document that specifies which api
functions are acceptable and which are not, only the checker tool and the
checker in CVI. You'll have to do a lot of guess-and-check, and rely on a
utility like dumpbin to check linkages. It's easy for a DLL to pass the
checker tool and still fail.

Finally, try to think of another way to solve the problem. NI is always
helpful, but they make it clear that external code (DLLs) are completely
unsupported in LV-RT. Their tech support will unlikely be able to help you.

In the end, I was able to create a driver DLL for my ethernet-based device
and everything works great. Just be aware that the process is pretty
challenging.

-joey

"Ed Dickens" <x@xxxxxxxx> wrote in message
news:1122486052450-247137@xxxxxxxxxxxxxxxxxx
> Though I have not had to do this yet, I've been told that you can get dlls
> certified by NI to run in the RTOS.
>
> But even doing this you'll still have to write LabVIEW VIs to call the
> dlls.
>
> Remember, you're dealing with LabVIEW Real Time. It is designed to
> programmed from LabVIEW. There are other Real Time operating systems
> you can get that are targeted from C/C++. You might want to look into
> those.
>
> Ed
>
>> I am conducting research on automated manufacturing processes. We have
>> an 8186 controller that is controlling our machine. The professor I am
>> doing research with and myself prefer to write programs in c or c++. We
>> would like to retain the real-time aspect of the Labview RT OS. We use
>> version 7.1. Is there a way we can have that os run a program we have
>> written in C? If so how would we do this.


.


Quantcast