Go Premium for a chance to win a PS4. Enter to Win

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

Using unmanaged C code in C#

Hi experts,

I am trying to figure out a way to use the opencv libraries in C#. I asked this question on a public board and part of the response included the following:
 
"For instance, you could build a managed (or native) C wrapper based on the OpenCV
facedetect.c sample (http://opencvlibrary.sourceforge.net/FaceDetection)"

Can anyone help me understand how to do this? I understand the basic concept of a wrapper but haven't written one before. I really need a walkthrough here. I am an experienced Java programmer but completely new to the .NET framework and C# language.

thanks!
0
jodeleeuw
Asked:
jodeleeuw
  • 2
1 Solution
 
gregoryyoungCommented:
writing your wrapper will be pretty straight forward (except for say the interop to unmanaged code). The best document I can point you to is http://msdn.microsoft.com/library/default.asp?url=/library/en-us/csref/html/vcwlkplatforminvoketutorial.asp.

pinvoking can get fairly in depth dealing with how things are marshalled (or it can be nice and easy) it depends on the interface you are dealing with.

After dealing with the pinvoking though you will just write nice normal wrappers around the procedural calls you have (the same as you would in java)

Cheers,

Greg
0
 
topdog770Commented:

// forum thread hitting the highest points
http://discuss.joelonsoftware.com/default.asp?design.4.179679.7


// down and dirty details... last half of the page
http://msdn.microsoft.com/msdnmag/issues/05/09/CAtWork/
0
 
topdog770Commented:
Finally...

Here's a more complete example

 http://www.codeproject.com/useritems/usingcppdll.asp
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

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