LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Calling a DLL and writing to console window

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,

 

Dan
CLD
Download All
0 Kudos
Message 1 of 8
(4,542 Views)

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. Smiley Sad

Some days I feel old... Sigh...


Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion

"... after all, He's not a tame lion..."

For help with grief and grieving.
0 Kudos
Message 2 of 8
(4,521 Views)

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!!!!

Rolf Kalbermatter  My Blog
DEMO, Electronic and Mechanical Support department, room 36.LB00.390
0 Kudos
Message 3 of 8
(4,515 Views)
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...

Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion

"... after all, He's not a tame lion..."

For help with grief and grieving.
0 Kudos
Message 4 of 8
(4,508 Views)

@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.

Rolf Kalbermatter  My Blog
DEMO, Electronic and Mechanical Support department, room 36.LB00.390
0 Kudos
Message 5 of 8
(4,506 Views)
That's cool. All I was looking for was an output window.

Mike...

Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion

"... after all, He's not a tame lion..."

For help with grief and grieving.
0 Kudos
Message 6 of 8
(4,497 Views)

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')?

Dan
CLD
0 Kudos
Message 7 of 8
(4,469 Views)

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.

Rolf Kalbermatter  My Blog
DEMO, Electronic and Mechanical Support department, room 36.LB00.390
0 Kudos
Message 8 of 8
(4,456 Views)