09-07-2017 06:37 AM
wiebe@CARYA wrote:
But why do you still need that? If you run the .NET code, the dll's stdout will end up in the string... At least, that's the plan.
Maybe I'm not understanding then. I don't see in your code where you're calling into a DLL that would call a printf. I just see LabVIEW code that pushes text into a stream. Let me look at it again and try it.
09-07-2017 06:46 AM
My apologies. I wasn't understanding. I'm about to give it a try now.
09-07-2017 08:34 AM
I wasn't able to use the snippet directly so I had to manually put it together, which required some searching for .NET methods - I've never used .NET before so I'm a little slow.
I'm not able to make it work if I've put it together correctly. I'm going to keep playing with it. I'm guessing maybe that the "Console" or "MemoryStream" methods are not really connecting me to STDOUT. The code runs without error, and my dll call is returning normally, just no output is seen. This is how I've implemented it:
(FYI, I'm highlighting code execution so the dll call loop is not running full speed - the read loop is able to execute repeatedly, it just returns nothing.)
09-07-2017 08:41 AM - edited 09-07-2017 08:41 AM
What errors\messages do you get when pasting the snippet?
Can you upload the dll?
Do you get a read when you run the other VI (Console.WriteLine)?
09-07-2017 08:52 AM
The code snippets seem to be manipulated by uploading or downloading. My own snippet changed from 35 kB to 17 kB.
Here's the snippet as attachment.
09-07-2017 08:55 AM
Attached is the dll and the source .cpp file. There are a few other routines in there as I've been tinkering a bit. The goal is to have the "printstuff" - which only has a printf and a return, work - without any of the redirect stuff in the other routines.
I haven't attempted the Console.WriteLine. I expect it will work, but I'll give it a try just to be sure.
09-07-2017 09:03 AM
The dll fails to load:
LabVIEW: Failed to load dynamic library because of missing external symbols or dependencies, or because of an invalid file format.
09-07-2017 09:19 AM
I really appreciate you putting in all this effort to help me with this. If I haven't said thank you before - thank you.
I rebuilt, removing all of the other unused routines. This should just contain a single printstuff routine.
09-07-2017 09:27 AM
Also, Console.Write does work and produces output in the Read loop.
09-07-2017 09:29 AM - edited 09-07-2017 09:34 AM
wiebe@CARYA wrote:
The dll fails to load:
LabVIEW: Failed to load dynamic library because of missing external symbols or dependencies, or because of an invalid file format.
You don't have the Visual C Runtime redistributable files installed that correspond the the Visual Studio version that was used to create the DLL! And this actually listens very closely, if you happen to have Visual C runtime V 16.00.29023 installed but the DLL was compiled in Visual Studio with Visual C runtime updated to 16.00.30319 then you are likely getting such an error.