by
Krull >> Mon, 15 May 2000 3:20:39 GMT
We are having a bit of trouble trying to send and receive string types from C++ written dll's. Does anyone know what parameter type the C++ side of the code should be set to?
e.g.
Jade....
x:String;
...
call externFn(x);
C++
void externFn(????)
A suitable C++ definition would be:
void externFn(const Character x[])
Where the Character type is type defined to char for an ANSI build and wchar_t for UNICODE as follows:
#if !defined(UNICODE)
typedef char Character;
#else
typedef wchar_t Character;
#endif /* !UNICODE */
and the same for receiving from an external function.
There are a number of different ways to do that; which one is the most appropriate depends a bit on the lifetime of the string and which module 'owns' the string or is responsible for allocating/deallocating the storage. If you can provide an example of how you want to return string data from C/C++, then we can advise on how to best match the JADE declaration with C++. In the meantime, you might obtain some insite from an earlier thread on this newsgroup, subject: "External functions/methods and complex parameters".
cheers
Krull