Click here to Skip to main content
15,886,362 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi All,

I am a beginner in COM & .net interoperability.
I am having COM server dll which I am using into .net client through RCW(Runtime Callable Wrapper).
I have defined one custom structure in COM server application which I want to pass to .net client.
How can I expose this structure and is there any means to pass its pointer to client?
I tried using VARIANT* but this gives me exception as follows:
"An unhandled exception of type 'System.NullReferenceException' occurred in COMClient.exe
Additional information: Object reference not set to an instance of an object."


Is it a problem related to STA and MTA?

Please help me in this...

Thanks in Advance.
Posted
Updated 31-May-11 18:41pm
v2
Comments
ggupta2009 14-Jul-11 1:02am    
Thank you very much barneyman.

I got a good idea from your solution.

1 solution

you can't pass ptr's between com and .net - one's memory is not addressable in the other

What you'll have to do is send a copy of the data over, and then marshal into .net

have a look at the size_is idl attibute on the com side

There's a good article here C# ATLCOM Interop code snipperts - Part 1[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900