how to : use c++ projects for windows phone (C#) -


now have several c++ dlls , source code. these managed dlls , can directly add them c# project reference. issue want use them in windows phone application (c#).

i don't know how achieve this, please

i know merely nothing these c++ projects, , contains lot of header files. have rewrite these codes fit windows phone? sad story..

or need recompile them different type of projects?

thanks patient

not sure how windows phone c# it, normal c# can:

a) load symbols directly c library, example:

using system; using system.runtime.interopservices; static class win32 {     [dllimport("kernel32.dll")]     public static extern intptr loadlibrary(string dlltoload);      [dllimport("kernel32.dll")]     public static extern intptr getprocaddress(intptr hmodule, string procedurename);      [dllimport("kernel32.dll")]     public static extern bool freelibrary(intptr hmodule);    } 

(this taken from: http://www.andyrushton.co.uk/csharp-dynamic-loading-of-a-c-dll-at-run-time/ after brief googling)

you need export c++ interface methods "c" that, e.g.:

extern "c" __declspec( dllexport ) int myfunc(long parm1); 

(from msdn: http://msdn.microsoft.com/en-us/library/wf2w9f6x.aspx)

b) use wrapper in c++/cli connect unmanaged c++ managed c#:

here's example: http://www.codeproject.com/articles/19354/quick-c-cli-learn-c-cli-in-less-than-10-minutes

do note syntax weird @ first look, , not eveything can used. however, gain ability use c++ classes - exporting "c" prohibits doing.


Comments

Popular posts from this blog

matlab - Deleting rows with specific rules -

jquery - How would i go about shortening this code? And to cancel the previous click on click of new section? -