Open jethac opened 8 years ago
Your changes will break the interface for getting object property. The size must always be in bytes and data is always is void. In C# side you should convert void data to string using property encoder.
<code langu /*
Ahh, breaking the interface would be bad. I'm a little concerned that we're talking past each other at the moment though; with the current pre-patch code, when you have an element in your XSD containing:
<LeGe.NativeProperty name="mystring" nativeName="MyString" nativeType="wchar_t*" access="get">
The auto-generated code will be:
void MyClass_MyString_Get(ObjectGUID instanceId, void** data, int* size)
{
MyClass* instance = reinterpret_cast<MyClass*>(instanceId);
static wchar_t* localData;
localData = instance->GetMyString();
*data = (void*)&localData;
*size = sizeof(localData);
}
Which doesn't seem right, seeing as:
*data
will have the location of localData
, not the location that localData
points to, and*size
will evaluate to sizeof(wchar_t*)
, rather than the number of bytes in the stringIs that what was intended?
Thanks for clarifying it, I will test the CodeGen with getter of type wchar_t* and fix the issue in the next update. please make a local fix, until I update master branch.
Alan
Thanks Alan! :smile:
I was having some difficulty marshalling a native wide string property into a managed string when I realised the code CodeGenDom was giving me was wrong.
The patch is somewhat self-explanatory - when it's a string, we want to:
Seeing as the repository includes the binaries, I thought about providing rebuilt binaries, but it might be easier to merge without them.