Re: Can I call a dll with a C++ Class Cstring variable?
- From: rolfk <x@xxxxxxxx>
- Date: Tue, 16 May 2006 18:40:07 -0500 (CDT)
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.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.
One way that might be possible is to actually only create three or four
C functions that are exported by a helper DLL. These functions would
allocate a CString, copy a CStr into it and out of it and one to
deallocate it. As far as LabVIEW is concerned you would treat the
CString simply as a uInt32.
Rolf Kalbermatter
.
- References:
- Can I call a dll with a C++ Class Cstring variable?
- From: Nils Gokemeijer
- Can I call a dll with a C++ Class Cstring variable?
- Prev by Date: Interface design help
- Next by Date: Re: protocol for SetCommState function call
- Previous by thread: Can I call a dll with a C++ Class Cstring variable?
- Next by thread: Interface design help
- Index(es):
Relevant Pages
|
Loading