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 / C# / June 2007

Tip: Looking for answers? Try searching our database.

using c++ developed dll in .net

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
YIguchi - 12 Jun 2007 03:17 GMT
Hi All,

i wanted to know how can i use c++ developed in my c# code.

I want to use crypto++ library in my c# code. Any pointer would be helpful.

Regards,
Y Iguchi
Arne Vajhøj - 12 Jun 2007 03:28 GMT
> i wanted to know how can i use c++ developed in my c# code.
>
> I want to use crypto++ library in my c# code. Any pointer would be helpful.

DllImport exist to use Win32 DLL's in .NET programs.

Arne
Ben Voigt [C++ MVP] - 12 Jun 2007 07:39 GMT
>> i wanted to know how can i use c++ developed in my c# code.
>>
>> I want to use crypto++ library in my c# code. Any pointer would be
>> helpful.

Use C++/CLI to call crypto++.  Make a library wrapping just the crypto
functionality you need, make it into a "ref class", and add it as a project
reference from your C# project, and you'll be able to use it just like the
Microsoft classes.

> DllImport exist to use Win32 DLL's in .NET programs.

And you need a C API to do so, not C++.  When C++ is exposed as COM/ActiveX,
then .NET supports the API that way.  But I don't think crypto++ is.

> Arne
Arne Vajhøj - 13 Jun 2007 03:28 GMT
>>> i wanted to know how can i use c++ developed in my c# code.
>>>
[quoted text clipped - 11 lines]
> COM/ActiveX, then .NET supports the API that way.  But I don't think
> crypto++ is.

Why write a C++ wrapper instead of simply calling the code
you want to call ?

Arne
Ben Voigt [C++ MVP] - 14 Jun 2007 06:04 GMT
>>>> i wanted to know how can i use c++ developed in my c# code.
>>>>
[quoted text clipped - 14 lines]
> Why write a C++ wrapper instead of simply calling the code
> you want to call ?

I meant to suggest that the wrapper should be at a higher level of
abstraction, providing application-relevant functions.  But I can definitely
see why you interpreted my suggestion as a thin one-to-one forwarder.

> Arne
YIguchi - 17 Jun 2007 04:03 GMT
Hi,

That is great .
I will be using crypto++ with that. I hope i will be use the same with c#.

Crypto++ compiles with /Mtd . I hope it will not cause any problem.

Are there any limitation in using the existing c++ Code with C# .net

Regards,
Y Iguchi

> >>>> i wanted to know how can i use c++ developed in my c# code.
> >>>>
[quoted text clipped - 20 lines]
>
> > Arne
YIguchi - 17 Jun 2007 04:14 GMT
Hi Ben,

I will be using crypto++ with the c#. I just wanted to confirm one thing
1. Does this method works with /Mtd too.
2. Is this approach has some limitations too. i just wanted to ensure before
using this approach.

Regards.
Y Iguchi

> >>>> i wanted to know how can i use c++ developed in my c# code.
> >>>>
[quoted text clipped - 20 lines]
>
> > Arne
Ben Voigt [C++ MVP] - 17 Jun 2007 06:29 GMT
> Hi Ben,
>
> I will be using crypto++ with the c#. I just wanted to confirm one thing
> 1. Does this method works with /Mtd too.

No, I think /MD or /MDd is required for C++/CLI to create a .NET assembly.
I doubt that will break crypto++.

> 2. Is this approach has some limitations too. i just wanted to ensure
> before
> using this approach.

The only limitation is that the code you write using the C++/CLI syntax is
only usable in a .NET program, so your customers need .NET installed.  And
of course not just .NET Framework, but also the updated VC++ runtime
(vcredist_x86).

Native C++ classes can be used in a .NET program via C++/CLI (not directly
from C# or VB) or from native code.  This feature is called "C++ interop" or
"It Just Works" and is much better than p/invoke for working with native C++
code or any library with C headers.

> Regards.
> Y Iguchi
[quoted text clipped - 25 lines]
>>
>> > Arne

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.