mingw-windows10-uwp
mingw-windows10-uwp copied to clipboard
Minimal Windows 10 Store ready sample of MinGW dll PInvoked from Windows 10 UWP application
mingw-windows10-uwp
Windows 10 Store ready sample of MinGW dll with C exported methods PInvoked from Windows 10 UWP application
- UWP appx bundle with MinGW dll passing Windows 10 Store Certification Kit checks
- Tested for x64 only
- Tested with MinGW-w64 64 bit compiler installed with MSYS2 toolchain
- Sample based on implementation of WinRT support for libVLC
Environment requirements:
Visual Studio 2017withUWP development toolsand"C++ Universal Windows Platform development tools"package installedx86_64 MSYS2installation with configuredpacmanpackager. Latest MinGW-w64 compiler build obtained withpacmanpackager by running following command in MSYS2 terminal:
pacman -S mingw-w64-x86_64-toolchain
- MinGW-w64
winstorecompatlibrary to redefine some forbidden API calls for UWP platform.winstorecompatlibrary is available in latest builds of MinGW-w64 and can be obtained along with x86_64-toolchain MSYS2 MinGW toolchain as described above.
Build steps:
- To build DLL launch MSYS2 MinGW-w64 64 bit compiler command line.
- cd to
MinGWDLLdirectory - Run
build.shscript to build MinGW dll. In background script does following things:- Creates custom
gccspecfile to linkwinstorecompatlibrary before linking to system libraries. Replaces linking withmsvcrt(Desktop Microsoft C runtime) with linking tomsvcr120_app(Visual Studio 2013 UWP platform C runtime).msvcr120_appis bundled along with installation of MinGW-w64 compiler. - Asks
gccto build sharedPureMinGWDLL.dlllibrary with custom flag-Wl,--dynamicbaseto pass Windows 10 Store Certification Kit security checks. - Runs
appcontainer.plscript to modifyPE headerofPureMinGWDLL.dllbinary. It setsappcontainerbit flag to be compatible with Windows 10 Store binary requriements.
- Creates custom
InvokeMinGWDllUWPdirectory contains Visual Studio 2017 UWP project to PInvokePureMinGWDLL.dllshared library and display obtained values on screen. To build just launchInvokeMinGWDllUWP.slnwith Visual Studio 2017 and run the Build. UWP solution referencesMicrosoft Visual C++ 2013 Runtime Package for Windows Universalto be bundled into appx package.