02-20-2013 02:03 AM
I have been using LabVIEW for a few years, but I am new to RT.
I have a device which comes with a Windows DLL. The device also comes with a set of LabVIEW VI's. The VI's are simple wrappers for the DLL functions (Call Library Function Node). Is it possible to port a Windows DLL to the RT environment?
Part of the device's initialisation it uploads two files to the device, these are firmware files. Would this be a problem on RT system?
Thanks.
02-20-2013 06:47 AM - edited 02-20-2013 06:50 AM
Do you have the (C) source code of the DLL? What RT system are you trying to run this software on?
First NI uses two different OSes for their RT systems.
One is based on Pharlap ETS which is a limited Win32 API compatible OS and uses the same executable file format as Windows. So it may be possible to load the DLL onto those RT systems and use it.
The other RT OS is based on VxWorks. This is a completely different OS which has a limited posix compliant system API and uses the ELF execuable format. Shared libraries to use on these systems have to be compiled using the VxWorks compile toolchain, either the free GCC based command line version or the commercial VxWorks IDE and toolchain.
Eventhough you may be using an RT system based on the Pharlap ETS system does not guarantee that you can use the DLL unaltered. It depends what Win32 APIs it does use and also with which Visual C compiler it was compiled. If the DLL was created with Visual C 6 and doesn't make use of unsupported Win32 APIs it will work. If it is created with newer Visual C versions it may pull in unsupported APIs through the Microsoft C runtime library eventhough it does not make use of such APIs itself explicitedly.
This link gives you an overview about the different NI RT systems and the OS used on each of them and this link gives you an utility for each LabVIEW version to check if a DLL is compatible with the according Pharlap ETS OS.
Chances are that you will have to recompile the DLL for your RT target and that will of course require you to have the source code of the DLL. Alternatively it may be easier to rewrite the driver in pure LabVIEW, if you don't have any experience with compiling C code.
02-20-2013 06:53 AM
@rolfk wrote:
Do you have the (C) source code of the DLL? What RT system are you trying to run this software on?
First NI uses two different OSes for their RT systems.
One is based on Pharlap ETS which is a limited Win32 API compatible OS and uses the same executable file format as Windows. So it may be possible to load the DLL onto those RT systems and use it.
The other RT OS is based on VxWorks. This is a completely different OS which has a limited posix compliant system API and uses the ELF execuable format. Shared libraries to use on these systems have to be compiled using the VxWorks compile toolchain, either the free GCC based command line version or the commercial VxWorks IDE and toolchain.
Eventhough you may be using an RT system based on the Pharlap ETS system does not guarantee that you can use the DLL unaltered. It depends what Win32 APIs it does use and also with which Visual C compiler it was compiled. If the DLL was created with Visual C 6 and doesn't make use of unsupported Win32 APIs it will work. If it is created with newer Visual C versions it may pull in unsupported APIs through the Microsoft C runtime library eventhough it does not make use of such APIs itself explicitedly.
This link gives you an overview about the different NI RT systems and the OS used on each of them and this link gives you an utility for each LabVIEW version to check if a DLL is compatible with the according Pharlap ETS OS.
The DLL is provided with the hardware. We don't have the source code.
Running the DLL through "Dependency Walker" shows it depends on:
WS2_32.DLL
SetupAPI.DLL
Kernel32.DLL
User32.DLL
AdvAPI32.DLL
Shell32.DLL
MSVCR80.DLL
MSVCP80.DLL
At the moment we are just trying to see if it is possible...
I take a look at those links.
Thanks.
02-20-2013 07:01 AM
The manufacturer has just come back to me and said the DLL communicates with Windows drivers for the device and is therefore not compatible with LabVIEW RT. That knocks that on the head then! 😞