Solved

Using unmanaged C code in C#

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

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.

Question has a verified solution.

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

Suggested Solutions

Article by: Ivo
C# And Nullable Types Since 2.0 C# has Nullable(T) Generic Structure. The idea behind is to allow value type objects to have null values just like reference types have. This concerns scenarios where not all data sources have values (like a databa…
We all know that functional code is the leg that any good program stands on when it comes right down to it, however, if your program lacks a good user interface your product may not have the appeal needed to keep your customers happy. This issue can…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

828 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