471,337 Members | 1,025 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,337 software developers and data experts.

managing c++ pointer reference from c#

I'm writing a C++ managed .dll that I will call from my C# app. The C+
+ code will need to return an object pointer to the C# that will need
to be passed back for subsequent method calls. The C# code doesn't
need to do anything with the pointer, just accept it as a return value
from the first method and then pass it to the rest.

Can anyone get me started here? I can't figure out how to type the
parameter in the C# dllimport statment and/or the c++ code.

thanks!
Deanna
Aug 27 '08 #1
1 1226
If your writing managed C++ then you don't need to use P/Invoke, you just
reference the DLL from your C# project and use its types just as if they had
been written in C#. DllImport is for calling unmanaged code.

If you still need to pass a pointer around you'd use System.IntPtr. If you
need more help please post some sample code of what you're trying to do.

HTH
"Deanna" wrote:
I'm writing a C++ managed .dll that I will call from my C# app. The C+
+ code will need to return an object pointer to the C# that will need
to be passed back for subsequent method calls. The C# code doesn't
need to do anything with the pointer, just accept it as a return value
from the first method and then pass it to the rest.

Can anyone get me started here? I can't figure out how to type the
parameter in the C# dllimport statment and/or the c++ code.

thanks!
Deanna
Aug 27 '08 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

8 posts views Thread by Braky Wacky | last post: by
13 posts views Thread by al.cpwn | last post: by
51 posts views Thread by Kuku | last post: by
33 posts views Thread by Ney André de Mello Zunino | last post: by
1 post views Thread by Screenbert | last post: by
41 posts views Thread by Summercool | last post: by
reply views Thread by rosydwin | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.