[Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 187
  • Last Modified:

Accessing functions in native C++ dll's from C#

Hi

I need to build a wrapper to access C++ dlls from C#.  Does anyone have any guidance on how thiss is done?

Thanks
0
xiyuzu
Asked:
xiyuzu
1 Solution
 
evilrixSenior Software Engineer (Avast)Commented:
Pretty simple to do using DllImport... see example below for 2 WIN32 API functions.

Some info...
http://www.csharphelp.com/archives/archive52.html
http://www.devx.com/dotnet/Article/6990
http://www.codeguru.com/csharp/csharp/cs_data/article.php/c4217
		[DllImport("kernel32.dll")]
		public static extern IntPtr GlobalLock(IntPtr hMem);
 
		[DllImport("kernel32.dll")]
		public static extern bool GlobalUnlock(IntPtr hMem);

Open in new window

0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now