What is the easy way to provide c# interface to my C++ unmanaged d

G

Guest

Hi,

if i have the unmanaged c++ source files, what is the easy way to provide c#
interface to this unmanaged c++ dll, should i use managed c++ wrapper classes
or use PInvoke or use the /clr compiler option ?

Thanks.
 
R

Rodrigo Corral [MVP]

Using /clr will not make any difference. You will need to convert your
classes into managed classes and its exposed interfaces must expose cls
compliant types, but this could be easy to accomplish or not. I think that
is a good migration path if you don't need backward compatibility.

If you need to ensure backward compatibility it will be a better option ot
make a managed wrapper arround your current code.

If you only expose your component through interop it will be difficult to
use for managed clients. I would prefer any of the others approach.


--
Un saludo
Rodrigo Corral González [MVP]

FAQ de microsoft.public.es.vc++
http://rcorral.mvps.org
 
G

Guest

Hi Rodrigo,

- Is there any automated process/tool to generate wrapper classes to my
unmanaged c++ dll ?

- When i use the /clr option i get link error LNK2001: unresolved external
symbol "char * __cdecl strdup(char const *)" (?strdup@@$$J0YAPADPBD@Z) .
how should i solved this error ?

Thanks a lot.
 
R

Rodrigo Corral [MVP]

I don´t know. I have not used SWIG. You could try it and tell us if it is a
good tool or not.


--
Un saludo
Rodrigo Corral González [MVP]

FAQ de microsoft.public.es.vc++
http://rcorral.mvps.org
 
G

Guest

Hi Rodrigo,

Is there is any differences in the capabiliies of those 3 approaches IJW,
Manage C++ Wrapper classes or PInvoke, for example if i can use polymorphism
in all the approaches in my C# Client ?

Thanks a lot.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top