Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Languages / Managed C++ / June 2005

Tip: Looking for answers? Try searching our database.

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

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
yaron - 06 Jun 2005 14:03 GMT
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.
Rodrigo Corral [MVP] - 06 Jun 2005 17:32 GMT
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.

Signature

Un saludo
Rodrigo Corral González [MVP]

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

yaron - 07 Jun 2005 07:50 GMT
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.
Rodrigo Corral [MVP] - 07 Jun 2005 11:25 GMT
> - Is there any automated process/tool to generate wrapper classes to my
> unmanaged c++ dll ?

AFAIK, no there isn´t.

> - When i use the /clr option i get link error LNK2001: unresolved external

http://support.microsoft.com/kb/814472/en-us

Signature

Un saludo
Rodrigo Corral González [MVP]

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

yaron - 07 Jun 2005 14:34 GMT
Hi Rodrigo,

What do you think about the swig tool ?
http://www.swig.org/
it generate c# classes and c++ wrappers using PInvoke.
- should i use it ?

Thanks a lot.
Rodrigo Corral [MVP] - 07 Jun 2005 16:21 GMT
I don´t know. I have not used SWIG. You could try it and tell us if it is a
good tool or not.

Signature

Un saludo
Rodrigo Corral González [MVP]

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

yaron - 07 Jun 2005 16:39 GMT
ok , i will.

Thanks Rodrigo.

> I don´t know. I have not used SWIG. You could try it and tell us if it is a
> good tool or not.
yaron - 09 Jun 2005 08:33 GMT
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.

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.