473,473 Members | 2,316 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Sample code for wrapping C++ DLL into .NET assembly

Hi,

I understand we could use p/Invoke to access most of the C/C++ DLL but there
are some cases the functions can only be accessed by C/C++ so it would be
good if I could create a .NET class to wrap around those functionalities.

Could someone point me an example of how to use VS C++.NET to do this? Any
tips will be highly appreciated!

Thanks very much!
John
Nov 17 '05 #1
1 2038
Hi John,
I understand we could use p/Invoke to access most of the C/C++ DLL but thereare some cases the functions can only be accessed by C/C++ so it would be
good if I could create a .NET class to wrap around those functionalities.


Based on my understanding, you want to wrap the native C/C++ classes in a
..NET assembly, if so I suggest you can refer to the following MSDN
documentation and an article from the Codeguru, which introduce the general
techniques on wrapping unmanaged C++ classes with Managed Extensions for
C++ classes that act as proxies:

http://msdn.microsoft.com/library/de...us/vcmxspec/ht
ml/vcmg_overview.asp

Head-Spinning Continued: The Managed Wrapper
http://www.codeguru.com/Cpp/Cpp/cpp_...cle.php/c4863/
However, if you just have concern on a non-COM interop scenario, such as
implementing a flat handle-style DLL API in a .NET assembly, then you can
find the solution and code samples in this Codeguru's article:

Interop: A Look at Managed C++
http://www.codeguru.com/Cpp/Cpp/cpp_...cle.php/c4845/
Hope this help!

Best regards,

Gary Chang
Microsoft Community Support
--------------------
Get Secure! ˇ§C www.microsoft.com/security
Register to Access MSDN Managed Newsgroups!
http://support.microsoft.com/default...sdn/nospam.asp
&SD=msdn

This posting is provided "AS IS" with no warranties, and confers no rights.

Nov 17 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

11
by: yawnmoth | last post by:
word wrapping normally treats some spaces as line feeds, if there hasn't been a line feed for quite a while. so while a string with eighty consecutive a's might not word wrap, a space placed...
5
by: | last post by:
Hi,all U can download dotNetHookLibrary in http://dotnethook.sourceforge.net . for instance, I have the fellowing code :...
4
by: Tim Menninger | last post by:
Just started working on this and have not found any real good resources out there. We have a lot of native C++ Dll code that we use for our app. We want to share the code so that C# ASP.net code...
2
by: RD | last post by:
In the development environment I occasionaly get a message "There is no code associated with this location" as I single step through the code using the F8 key. Typically it occurs when I try to...
30
by: Chad Z. Hower aka Kudzu | last post by:
I need to provide a series of demos for an assembly. There are potentialy several dozen of them. None of them are very complex, however maintaining two versions of them will be very maintainance...
3
by: prabhupr | last post by:
Hi Folks Not sure if this is the right group, if not please re-direct me to the right one. Here is my question =============== When I compile my ASP.NET WEB project from VS 2005 (.NET...
8
by: _iycrd | last post by:
Specifically I need to wrap an older Win32 DLL in a managed class. I had this running with VS2003's Managed Extensions, though it required two separate classes. With C++/CLI this was supposed...
7
by: Bruce | last post by:
I have a DotNet C++ class that I would like to fire an event to then be used by VB.Net using the With Events keyword. I have experience creating connection point events for ActiveX controls, it is...
3
by: =?Utf-8?B?U0Q=?= | last post by:
Hi, I'm using the the MSDN sample "COM Interop Part 2 Sample" (CSharpServerWithCOMClient.sln). The C# COM component gets registered when the solution is built. Somehow the component doesn't get...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.