04-17-2015 04:33 AM
Hi All,
I posted this an a separate thread, but thought it might warrant its own....
I have attached a simplified version of what I want to call from LV.
The function "triple", takes an integer and multiplies it by 3. In addtion, it writes some 'debug' text using cout (see source code within zip folder)
I can call the function from LabVIEW without any issues, and see that it performs its tripling function. However, I can't see any of the cout text.
For info, the DLL was compiled in MinGW.
Any help would be most welcome.
Thanks,
04-17-2015 09:46 AM
LabVIEW: No console, no console out...
If you want debugging info you will have to take another route like writing it to a file, or passing it back as an optional datavalue.
Mike...
PS: Please tell me that the 1983 in your user name is like the year you graduated college, or even high school, and not the year you were born.
Some days I feel old... Sigh...
04-17-2015 10:27 AM - edited 04-17-2015 10:28 AM
By default Windows GUI applications do not allocate a console since it is normally not used (a console window poping up in a GUI application would be in most situations simply outright annoying!). You can do that in your DLL anyhow by calling the Windows API AllocConsole().
Alternatively LabVIEW has its own debug console window. Check out the Exernal Code Reference manual for the function DbgPrintf(). Don't forget to disable either console for your release build of your DLL!!!!
04-17-2015 10:35 AM
04-17-2015 10:38 AM - edited 04-17-2015 10:39 AM
@mikeporter wrote:
Ahhh... Very good to know. So this call pops up a window that you can write to? I can thing of a lot of places where that could be helpful.
Mike...
No, there only exists a DbgPrintf() but no DbgScanf(), DbgGetchar() or DbgGets() or similar! So it is an output only console.
04-17-2015 11:25 AM
04-19-2015 02:55 AM
Rolf,
Is DbgPrintf() only available via a Code Interface Node, or should I be able to call it from some C++ compiled into a DLL (and called via 'Call Library Function')?
04-19-2015 04:32 AM - edited 04-19-2015 04:36 AM
Code Interface Nodes are not supported anymore. As to calling LabViEW manager functions, that works in shared libraries (dlls) just as much.
You need to include extcode.h from the <LabVIEW>/cintools directory in your source code file and link the dll with labviewv.lib from the same directory. However labviewv.lib is a coff object format file specifically for MS C compilers. Other compilers might have trouble tot read that, although I would expect Mingw to have added support for that to the gcc toolchain.