The question occasionally arises about using a C++ DLL within a Windows Store app. There are a few thing to know about this.

First, Visual Studio will let you import the DLL into a project, no problem, and the project will likely compile with whatever calls you make to that DLL. However, it won’t actually run unless you add a Reference in Visual Studio to that DLL.

Second, if you’re importing DLLs that are already built, there is a requirement that the DLL is built with Visual Studio 2012, otherwise it has a dependency on a different version of the C runtime library (CRT). Windows Store apps can only take a dependency on the VS2012 CRT (see this blog post).

Third, if you’re working in a language like C++ or C# via P/Invoke that can call DLL exports directly, then you can just use the DLL. For other languages like JavaScript, or to have a better C#/VB experience, you can wrap the DLL inside a WinRT component (written in C++) that then plugs into the language projection layers. This will add minimal overhead to the calls and then make the DLL accessible in whatever app language. This is clearly a good solution for SDKs or libraries, with the caveat that you’ll need to rebuild the DLL in VS2012.

The last requirement for a DLL is that it must use only whitelisted Win32 APIs; other APIs are blocked for Windows Store apps and will fail at runtime.


Comments are closed