03-16-2016 03:47 AM
Hello every one,
I am trying to develop an application for devicenet PCI card in labview environment ( beginner to labview). There is a DLL file for the PCI Card from the vendor. But it is too complicated for a beginner to call every function with in the DLL from labview. Hence I am trying to re-use a VC++ program (running properly)that calls some functions from the vendors DLL library . To do that, I have created DLL file which includes all headers and DLL library of the vendor as it is shown in the attached figure. But I couln't see the effect on the device. is that possible to create a DLL file for labview which has DLL library with in it? if not, how I may implement the program shown in the figure?
I would like to extend a huge regards in advance.
Solved! Go to Solution.
03-16-2016 04:46 AM
It's not something I have a lot of experience in so I don't know all the details of limitations/requirements etc. - but it is definitely possible to create wrappers for DLLs and then use them in LabVIEW - sometimes this is necessary to be able to convert some native C/C++ data types/structures into something which you can pass to/from LabVIEW from your other DLL.
There's a link here: http://digital.ni.com/public.nsf/allkb/06ECDC689DDA0F3D862574440074CD95
03-16-2016 04:51 AM - edited 03-16-2016 04:53 AM
DLL is the abbreviation for dynamic link library. The idea is that a DLL is a library of routines that can be used by various executable modules and another DLL is also just a code module. So yes it is definitely possible.
For that to work you would usually link your DLL with the import library (usually you link multiple import libraries to your DLL project already such as kernel32.lib. user32.lib, advapi32.lib, etc.). This import library does attempt to load the according DLL as soon as your DLL is loaded and resolves the function calls into the other DLL. Now the dependent DLL has to be in a location so that Windows can locate it based on the DLL name. For that there is the DLL search path of Windows which applies here.
However most import libraries do resolve the function calls directly at load time and will usually fail the load of your DLL if any of the DLLs or symbols in the DLL can't be found. So unless your PCI card vendor created an import library which does do delayed load, LabVIEW would already have barked at you that it couldn't load your DLL or one of its dependencies.
Of course the import library could do delay loading but then you do proper error handling in your code by checking error return codes and such?
03-17-2016 01:17 AM
Dear Developer, I would like to pay a huge respect for your help. after wrapping my dll file, it is working well
03-17-2016 01:20 AM
Dear Rolf Kalbermatter, I would like to pay a huge respect for your detail explanation and genuine help. After wrapping my dll file, it is working well