简体   繁体   中英

Can we write or call “C code” in XAML for Windows Phone 8

Can we write or call "C code" in XAML for Windows Phone 8,

i'm having C library and i have to use it in WP8 application. any idea..

Yes you can - but you have to link it against a C++ project. What you need is a WinRT component that links against that library and acts as a wrapper. That component can then be used in C#.

Check out MSDN docs .

Windows Phone doesn't support P/Invoke so, no. You can't. Especially if you want your app to be approved for the App Store:

4.2.2

For Windows Phone OS 7.1 Apps that target Windows Phone OS 7.1 must not invoke native code APIs by using PInvoke or COM interoperability.

For Windows Phone 8 Apps that target Windows Phone 8 must not invoke native code APIs other than the APIs listed at Win32 and COM API for Windows Phone 8.

Remember, your C library is probably pre-compiled for x86 which means that you would have to re-compile the source for different devices.

Your best bet is to check out the C source and see how difficult it would be to port to C#.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM