Solved

Using unmanaged C code in C#

Posted on 2006-07-07
3
1,517 Views
Last Modified: 2008-02-01
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
Comment
Question by:jodeleeuw
  • 2
3 Comments
 
LVL 37

Accepted Solution

by:
gregoryyoung earned 500 total points
ID: 17061354
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
 
LVL 12

Expert Comment

by:topdog770
ID: 17061361

// 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
 
LVL 12

Expert Comment

by:topdog770
ID: 17061400
Finally...

Here's a more complete example

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

Featured Post

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

In order to hide the "ugly" records selectors (triangles) in the rowheaders, here are some suggestions. Microsoft doesn't have a direct method/property to do it. You can only hide the rowheader column. First solution, the easy way The first sol…
Summary: Persistence is the capability of an application to store the state of objects and recover it when necessary. This article compares the two common types of serialization in aspects of data access, readability, and runtime cost. A ready-to…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

760 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now