Update 1:
I am wondering whether I can reference to a .lib file, but it seems that I cannot. If this is true, and I have no source code of the C++ project, How can I use its methods? Btw, I'm using FastCV library.
I come across a situation that I need to call C++ methods from C# code. The C++ generated files structure:
lib
--libfastcv.lib
--vc120.pdb inc
--fastcv.h
--fastcv.inl
--stdint.h
I know how to call C++ methods from C# :
[DllImport("libfastcv.lib",CallingConvention=CallingConvention.Cdecl)]
public static extern <ReturnType> <MethodName>(<Parameters>);
But I think the .h and .inl files need to be included in my C# project as well. So how to include them?
Thank you very much.
1. Create a C++ header file: fastcv_c#.h
This file contents will look something like this:
#include "fastcv\fastcv.h"
//<fastcv headers>
namespace fastcv_c#
{
puclic ref class FASTCV_c#
{
public :
<constructor declarations>;
<API declarations>;
}
}
Please include the proper path to <fastcv headers > and <fastcv lib> in the properties option of Visual Studio
2. Create a C++ source file containing the API definitions.
3. Refer this C# project :For instance:
using fastcv_c#;
Hi Krishanu,
Thank you very much for your help.
I will follow your instruction and give a try, and keep you posted.
Btw, I just wonder why QualComm doesn't provide C# Dlls directly to save our time and efforts. I will gradful if they could do so.
Cheers,
Winston
Hi krishanu6690,
Thank you very much for your reply.
Now, I just back to my home and found that I do not know how to write the constructor declarations and API declarations.
I want to detect faces. So I am gratefull if you could give an example of the header file?
I am looking forward to your reply.
Best regards,
Franva
Hi
Sorry for asking so many questions, but here is another one.
The 2nd step you mentioned : Create a C++ source file containing the API definitions.
What does the C++ source file containing the API definitions look like?
Hi krishanu6690,
After seeking face detection methods in the fastcv.h for several minutes, I just cannot find any.
I highly appreciate that if you could write me a small but completely example which contains the .h file, C++ file and C# files in a C# Windows Phone 8 project.
Thank you again.
Best regards,