How to call C Language Program from Windows Store Apps 8.1 uisng C# RRS feed

  • Question

  • We are trying to do a Store App on Windows Surface Pro 3.

    We already have a set of libraries which is written in C language and being used in android and ios apps. So how can we call those functions present in those header files in windows store apps 8.1 using C# language

    If so please give some samples as it is very urgent where we need to confirm them whether its possible or not....

    • Edited by Sharathm1 Friday, December 19, 2014 2:31 PM
    Friday, December 19, 2014 12:55 PM


  • Hello,

    You have a couple of options. You can compile the C functions into a standard DLL and then use PInvoke to call into your library. Unfortunately this will require a lot of manual conversion of the functions from native types to managed types.

    The second and the one that I would personally implement is to create a runtime class library in C++ / Cx that contains and exposes your C code. You can create entry points into the runtime class that expose the C functions. You can then consume the runtime class from managed code simply by adding a reference to it in your managed project.

    Walkthrough: Creating a basic Windows Runtime component in C++ and calling it from JavaScript or C#

    Calling Native Functions from Managed Code

    I hope this helps,


    Windows SDK Technologies - Microsoft Developer Services - http://blogs.msdn.com/mediasdkstuff/

    Friday, December 19, 2014 9:51 PM