I am trying to create a wrapper library which includes functions from another dll. I have successfully created this task on Visual Studio and it works fine. However, I am having trouble including two dlls in the same LabVIEW project, where one dll (Wrapper library) calls functions from original dll by getting any data from LabVIEW. In this way, I can call functions that include callback function as parameter. I attach two pictures to give an idea what I am trying to do.
In picture Wrapper library, the wrapper function gets a structure as parameter, and then inside its body call the original function. In further, it also includes the callback function by passing the same structure to its parameter (as described in picture original dll).
My question: Is there any way to include dll dependencies in VI? Or is there any other way to call functions from dll which has callback function as parameter?
Looking forward to your replies.
Solved! Go to Solution.
What have you tried and where does it fail?
LabVIEW should be able to find the dependencies, if they are placed in LabVIEW's search path, in a sub dir of the application\project or in the path of the dll. If you must (not sure why) load a dll dependency that cannot be found, you could force loading it by using a CLFN and specify the path on the diagram. That will load it. Of course, loading the dll that uses it will need to be postponed until the dependency is loaded, or it will fail.
You can get a pointer to a dll's function with LoadLibrary and GetProcAddress. That pointer can serve as a callback input. It doesn't matter if the function is in the same dll or not as the function requiring the callback.