• Advertisement
Sign in to follow this  

[.net] C# and COM Marshaling Problems

This topic is 3882 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi, I am certainly not an expert to C# and COM/Marshal. I cannot manage how to handle this problem: I want to call the following COM function from a C# Programm: IDL Description: (Simplified) interface IaIf : IDispatch { ... [id(20), helpstring("")] HRESULT getSomething([in] int numRows, [out] double* pos, [out] int* reflections, [out, retval] int* result); ... }; C Definition: (Simplified) STDMETHODIMP CMyClass::getSomething(int numRows, double *pos, int *reflections, int *result) { *result = IO_OK; for(int i=0;i<numRows;i++) { pos[posIndx] = someDouble1; pos[posIndx+1] = someDouble2; pos[posIndx+2] = someDouble3; reflections = someInt; } return S_OK; } Basically, this method fills to arrays (double and int) with some data. The problem is that the vendor made an error in the idl in my opinion. If you call this from C#, you get ONE double and ONE integer back instead of getting an array of doubles and integers or at least a pointer to them. (It should have been [in] double*, [in] int* instead maybe??) Since I cannot ask the vendor to correct this, does anyone could help me in solving this issue (Marshaling?, C++ Wrapper) I just cannot manage to solve it myself. Thanks a lot! Régis

Share this post


Link to post
Share on other sites
Advertisement
Sign in to follow this  

  • Advertisement