Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Using unmanaged C code in C#

Posted on 2006-07-07
3
Medium Priority
?
1,524 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 37

Accepted Solution

by:
gregoryyoung earned 2000 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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

Introduction Although it is an old technology, serial ports are still being used by many hardware manufacturers. If you develop applications in C#, Microsoft .NET framework has SerialPort class to communicate with the serial ports.  I needed to…
Entity Framework is a powerful tool to help you interact with the DataBase but still doesn't help much when we have a Stored Procedure that returns more than one resultset. The solution takes some of out-of-the-box thinking; read on!
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…

688 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