04-12-2016 06:37 AM
04-13-2016 12:44 AM
is it possible to attach to a lw vi a c++ code that uses this dll? The
dll works well in c++ but it is not as accessible as it would be whei
integrated in a vi - actually, it is all about conrolling the chip by
mans of lw!
04-14-2016 12:20 PM
Hi mpop,
When you say "lw", are you referring to LabVIEW or LabWindows™/CVI™? And what do you mean when you say that "it is not as accessible as it would be whei integrated in a vi - actually, it is all about conrolling the chip by
mans of lw!"? Are you asking how to call a C++ dll in LabVIEW? If you are wondering how to call C++ code from LabVIEW, here is a link that should help to answer your question.
04-14-2016 12:55 PM
04-15-2016 01:18 AM
Yes, LW means labview. The message was written on mobile phone!
I'm thinking that I'd start writing a c++ code that uses the dll but I would't use it much since it's not compatible with LW environment. If I could call it from LW, then it would start to make sense writing this code. It's like this code is a bufer between LW and the DLL since the DLL is not directly usable from LW?
Kindly advise! Thank you!
04-15-2016 09:29 AM - edited 04-15-2016 09:29 AM
Hey mpop,
To expand on Michael78's post earlier, LabVIEW's Import Shared Library Wizard is normally used to create or update LabVIEW wrapper VIs for functions in a .dll file (or .framework for OS X, or .so file for Linux). This wizard uses the Call Library Function Node, which does not support the C++ this pointer or calling methods in C++. That being said, as Michael78 mentioned, you will need to create a custom wrapper with for each function in order to use this C++ DLL in LabVIEW. You CAN use C++ code but it must be wrapped within C functions to be used in LabVIEW. That being said, a C++ DLL with only primitive data types should be able to be used without having to manually create wrappers.
Hopefully, this helps!
04-15-2016 11:54 AM
@mpop wrote:Yes, LW means labview. The message was written on mobile phone!
I'm thinking that I'd start writing a c++ code that uses the dll but I would't use it much since it's not compatible with LW environment. If I could call it from LW, then it would start to make sense writing this code. It's like this code is a bufer between LW and the DLL since the DLL is not directly usable from LW?
Kindly advise! Thank you!
It's not so much the fact that you use a C++ compiler or not but what type of functions you export. Basically anything C++ specifc like classes, class methods and such are not usable from the Call Library Node, The reasons are manyfold and some pretty technical but the most important one is that there doesn't exist a binary application programming interface standard for C++. Each C++ compiler does it in its own way partly because it's fun to be different, partly because certain C++ compiler builders patented techniques like structured exception handling (SEH) so that other C++ compiler builders couldn't use the same methods. As such the creation of a Call Library Node equivalent for C++ code is a practical impossibility.
If you have the C++ code for a library you can easily expand it to add static function exports to the llibrary that then call the actual object methods, otherwise you need to write a wrapper DLL in C++ that exports standard C functions to wrap the object methods. Since you call C++ code you need to use a C++ compiler but the DLL you create needs to export standard C functions for the Call Library Node to call into.