0

I have a SDK written in C# targeting Win10 UWP apps. It uses SQLite and works perfectly on C# client apps.

But can a C++/javascript app use my SDK with the SQLite dependency? A winmd (windows runtime component build) would be required in case the SDK has to be UWP compatible since a UWP app can be in C#/C++/javascript/Visual basic.

I have posted this in msdn forums and they say i would need a windows runtime component for all the 3rd party dependencies for it to work. Have already tried wrapper projects and wrapper winmd build, it does not work. I am unable to find any winmd build for SQLite library.

Please advise on what can be done here. Any help is really appreciated.

Uwe Keim
  • 39,551
  • 56
  • 175
  • 291
  • Isn't [SQLite for Windows Runtime](https://visualstudiogallery.msdn.microsoft.com/23f6c55a-4909-4b1f-80b1-25792b11639e) is the one that's suppose to work in Windows Runtime component? – Andrei Ashikhmin Aug 23 '16 at 16:46
  • @AndreyAshikhmin : All the examples I can find are written in C#. I cant find any example to use this in C++. Also SQLite has a new library for Universal Windows called "SQLite for Universal Windows Platform" and its recommended to use this. Cant find a way to use any of these. – Sumeet Devidan Aug 24 '16 at 05:40
  • 1
    SQLite for Universal Windows Platform will only work in normal C# UWP project, but to make your library work across languages it has to be a Windows Runtime component. And for Windows Runtime component, there is a special version of SQLite called SQLite for Windows Runtime. If you write WinRT component using this version, it's suppose to work as you want. – Andrei Ashikhmin Aug 24 '16 at 05:52

2 Answers2

0

But can a C++/javascript app use my SDK with the SQLite dependency?

Yes, as in msdn forums said, you will need to wrapper in WinRT component universal apps.

Have already tried wrapper projects and wrapper winmd build, it does not work.

I don't know what blocks you, but you can refer to Writing a SQLite wrapper component for universal Windows apps, there are detailed steps you will need to follow, and samples you may have a look.

Grace Feng
  • 16,564
  • 2
  • 22
  • 45
  • I am using SQLite Net PCL, SQLite Net Async and NewtonSoft JSON libraries in my SDK project. These libraries are in C#. The SQLite libraries provide ORM capabilities while using the wrapper you have suggested would be using raw sqls with custom parsing. Even if i create a wrapper WinRT build for these libraries, how do i include the actual dll of these libraries in the client C++ app? The C++ UWP app does not allow me to add reference to these dlls although i can include the wrapper winrt build. – Sumeet Devidan Aug 26 '16 at 08:01
0

I tried various approaches to make this project work and found some success in the following: Following is the project structure I made along with dependencies :

Client Application (in C++):

  1. Wrapper winmd library.

Wrapper winmd library (in C#): (I generate a winmd component from this project)

  1. My SDK project

My SDK project (in C#):

  1. SQLite Net.

  2. SQLite Net Async.

  3. Newtonsoft JSON.

When I build the client application, I get the wrapperlibrary.winmd file but I dont get the corresponding dlls from the 3rd party dependencies in the output directory (SQLite and Newtonsoft). So i manually copied the required dlls to the output directory of the C++ application. Now it seems to work correctly, I can verify correct usage of the 3rd party libraries and my C# code. Presently I am just trying to make the setup work as a poc and worry about the packaging later. The issue I now face is that my SDK also has some UI elements, so essentially compiled .xbf files for the "XAML" I have.

I have asked this question in another thread to not go off main topic here.