If i call my COM-Method with something like this
d.someMethod(string, doule, ref string);
I get the error mentioned above. the method thats called is something like this
STDMETHODIMP SomeClass::someMethod(BSTR, DOUBLE, BSTR*)
As long as i dont assign some value to BSTR* it works fine.
EDIT: IDL Description
interface IDistanceClass : IDispatch{
[id(1), helpstring("some helpstring")] HRESULT someMethod([in] BSTR firstarg, [in] DOUBLE secondarg, [in,out] BSTR* returnme);
};
EDIT2: As long as i pass only 1 Character like *returnme = "T" it works fine. But when it needs to be a string it throws, even if i assign a pointer to a string i get an error.
The solution is quite simple after you guys helping me out :-) As it turns out i need to do something like this:
string someString = "TestME";
_bstr_t s(someString.c_str());
*returnme = SysAllocString((BSTR)s);
Works well for me.
I am answering this myself so that maybe someone else with this issue wont need to search any longer. Hopefully this will help others too.