06-02-2022 05:35 PM
Here is a simple function:
GetPDFPageCount
function:
=====
GetPDFPageCount(const FileName: PWideChar): LongInt; stdcall;
I have tried defining the Argument:
FileName as string input but the dll was not able to read the filename.
Question: how does LabVIEW DEFINE PWideChar input datatype?
Anthony
Solved! Go to Solution.
06-03-2022 06:13 AM - edited 06-03-2022 06:24 AM
@Anthony_L wrote:
Question: how does LabVIEW DEFINE PWideChar input datatype?
Simple answer: Not!
Complicated answer: You have to do some C compiler work of your own on the LabVIEW diagram. Basically a PWideChar is the Pascal variant of LPWCHAR Windows datatype. So you have to call the Windows API MultiByteToWideChar() to turn the LabVIEW string, which is an 8-bit ASCII string, into a Unicode Widechar array.
You can find in this post a library to do the conversion. I would use the variant that creates an U16 array. It has the advantage that you do not need to deallocate any pointers after use, since the data is a LabVIEW array and managed by LabVIEW directly.
Your function parameter then has to be configured to be an Array of UInt16, Passed as C string pointer.
06-03-2022 11:33 AM
Rolfk:
That worked perfectly!!! Thanks!!
Here is a picture of the code base
Anthony