Solved

Using unmanaged C code in C#

Posted on 2006-07-07
3
1,518 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Different Delete Messages 7 37
Server Error 11 47
Importing CSV file encoded in UTF-8 in SQL SERVER 2008 using BULK INSERT 5 31
Close form "before" open 3 27
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
Migrating to Microsoft Office 365 is becoming increasingly popular for organizations both large and small. If you have made the leap to Microsoft’s cloud platform, you know that you will need to create a corporate email signature for your Office 365…
Both in life and business – not all partnerships are created equal. As the demand for cloud services increases, so do the number of self-proclaimed cloud partners. Asking the right questions up front in the partnership, will enable both parties …

896 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

12 Experts available now in Live!

Get 1:1 Help Now