Hello everyone!
I will appreciate for help. Faced with strange behavior in the COM module.
I have the structure defined in the idl file
Also, I have a class where I define a method which works with this structure:
IDL file:
h file:
When I debug it into the original project, it all works perfectly. But, in other projects, where I import my COM library, I always get a crash via to function call. (function doesn't do anything, crash in call command)
I know about specific in memory sharing in COM. So, I tried to use the object with CoTaskMemAlloc. I used CoTaskMemAlloc on the client side, used it in the COM Library, and returned it to a client where filled with the necessary data, but nothing helped.
Do you have any idea, where is my mistake?
Thank you in advance!
I will appreciate for help. Faced with strange behavior in the COM module.
I have the structure defined in the idl file
Code:
typedef struct MEDICAMENT_TYPE
{
BSTR bstrId;
long lIdType;
long lPosSize;
POSOLOGY arrPos[ARRAY_SIZE];
BSTR bstrRoa;
BSTR bstrTkgRsn;
BSTR bstrUnit;
BSTR bstrAppInstr;
BSTR bstrPrscbBy;
long lAutoMed;
long lRep;
long lSubs;
double dNbPack;
long lPrivateFieldsSize;
PRIVATE_FIELD arrPrivateFields[PRIVATE_FIELD_ARRAY_SIZE];
} MEDICAMENT;IDL file:
Code:
[id(16)] HRESULT AddDrug([in]struct MEDICAMENT_TYPE** medicament, [in]VARIANT_BOOL isDeletePrevDrugs, [out, retval]VARIANT_BOOL* pbStatus);Code:
STDMETHOD(AddDrug)(/*[in]*/struct MEDICAMENT_TYPE** medicament, /*[in]*/VARIANT_BOOL isDeletePrevDrugs, /*[out, retval]*/VARIANT_BOOL* pbStatus);I know about specific in memory sharing in COM. So, I tried to use the object with CoTaskMemAlloc. I used CoTaskMemAlloc on the client side, used it in the COM Library, and returned it to a client where filled with the necessary data, but nothing helped.
Do you have any idea, where is my mistake?
Thank you in advance!