05-16-2006 04:57 PM
05-16-2006 06:15 PM
I'm afraid this won't really be possible without a wrapper DLL. A CString is more like an object with internal pointers and last time I checked into a DLL with a disassembler it seemed that the actual layout of the internal structure depends on the size of the string that is contained, with small strings being entirely embedded and larger strings being a pointer to the string. Trying to figure out these difficulties is something you should leave to compiler developers and not try to do yourself.
@Nils Gokemeijer wrote:So,we bought an optiphase interferometer, and it comes with a dll and with LabVIEW example code.However, there is a big problem!The dll is a C++ dll and requires the C++ Cstring class!for example I can't get the function Boolean LoadDemodulatorDSPCore(Cstring arg1, U8Bit arg2) to work.They did provide a GetDllVersionchar(Cstr arg1, long arg2) which does work, (offcourse, it uses a standard C string pointer)but GetDllVersion(Cstring arg1) does not work. (offcourse not, it using the Cstring class)Is there a way to get CString classes to work in LabVIEW? (with a struct, or an binary array or whatever?)Or do I have to write a wrapper dll to convert CString classes to standard C string pointers?Thanks.
08-06-2007 05:27 AM
08-06-2007 09:52 AM
Sorry,
No solution yet, we are still using their standard interface application and A/D to read the signal.
-Nils
08-20-2007 04:10 AM
06-02-2008 01:19 PM
Dear Nils and Robert,
I have the same trouble with the DLL and their system and am trying to write a DLL.
You both seemed to try already and I would like to hear anything helpful.
Have you gotten any progress?
Thanks,
Chang
06-02-2008 01:55 PM
06-03-2008
01:57 PM
- last edited on
05-28-2025
01:28 PM
by
Content Cleaner
Dear Nils,
LabVIEW provides support for passing and returning the following string data types with the Call Library Function Node:
C String Pointer - a string followed by a null character
Pascal String Pointer - a string preceded by a length byte
String Handle - a pointer to a pointer to four bytes for length information, followed by string data
String Handle Pointer - a pointer to an array of string handles
Neither LabVIEW nor LabWindows/CVI can call C++ class methods and properties from a DLL. To call methods and properties in a C++ DLL, you will need to use C-style wrapper functions that will make calls into the C++ class methods and properties. You may also be able to use Andy's post, but I havn't tried it.
For more information on Rolf's suggestion to "treat the CString as a uInt32", please see Configuring the Call Library Function Node in the LabVIEW 8.5 Online Help files. There you can read, "If the function you are calling returns a data type not listed, choose a return data type the same data size as the one returned by the function. For example, if the function returns a char data type, use an 8-bit unsigned integer. A call to a function in a DLL cannot return a pointer because there are no pointer types in LabVIEW. However, you can specify the return type as an integer that is the same size as the pointer. LabVIEW then treats the address as a simple integer, and you can pass it to future DLL calls."
06-03-2008 03:32 PM - edited 06-03-2008 03:35 PM
Something along these lines should work:
@robert_p1 wrote:
Very sorry, but there's abolutely no progress on my side.
Regards,
Robert