ActiveX Control crashing trouble today
Yesterday he called again and asked if I could help. He has a PutValue method for filling data which constantly crashes. GetValue works by the way.
This time I had an idea. To analyze the functions, I created a dummy Visual C project and used #import line. The build the project and Visual Studio creates the C++ includes for this type library. In C++ the function looks like this:
HRESULT PutValue (BSTR FieldName, VARIANT Value, VARIANT * RetVal );
As you see the function takes one string, a variant and a byref variant for the result. Now Xojo creates this delegate:
Delegate Function PutValue_Func3(this As Ptr, FieldName_Param As Ptr, Value_Param As Ptr, RetVal_Param As Ptr) As Integer
And there is the mistake. The variant needs to be passed by Value, not by Reference. This causes crashes as stack contains not enough data 4 bytes for the pointer instead of 16 bytes of the variant structure.
more in feedback case 34221.
I also found case 7195, so this problem could be there for over 5 years. So I now hope that Xojo engineers can find and fix this bug, so my client can enjoy using Xojo to write the apps instead of Delphi.