Monday, August 24, 2020

Trials and Tribulations of Getting Gateware to Compile in C++/WinRT

 Since last week, I have finished my first draft of my research paper on the port of Gateware to UWP. In the process of doing that I managed to bring all of the Gateware libraries to an C++/WinRT template project and get it compile successfully. I am not using any of the libraries but it was not a plug and play process, there were compiler errors that needed to be taken care of. This is blog post I will be going over what I had to do to get it to compile.

The first thing I did was include the libraries in a C++/WinRT template:


pch.h:
Top of the "main" file:


The First Error

This led me to GRasterSurface_win32.hpp.

This function is found in wingdi.h. Turns out it is not found because it is found under:

This led me down the rabbit hole of "What is WINAPI_PARTITION_DESKTOP?" After some googling I found a Microsoft doc that went over what it is:
So SetDIBitsToDevice only works on a Win32 desktop app as a UWP app is WINAPI_PARTITION_APP.
I ended up fixing this by just bypassing GRasterSurface_win32 and using the dummy implementation for now.
That fixed the compiler errors.

Prototyping a GWindow Implementation

Using what I found out with the WINAPI definitions, I edited GWindow.hpp:
GWindow_UWP.hpp is the prototype. I started to fill out some of the cookie cutter stuff in my implementation:

Summary

This exercise was immensely helpful in giving me ideas on how I will be doing my port over the next 3 months. It also helped quite while finishing up my rough draft over the last week. I do see the example "triangle.h" that we give end-users changing quite a bit. I also believe end-users are going to have to know some C++/WinRT API calls, this will have to be disclosed to them.

The next 3 months are going to be busy and I definitely have my work cut out for me. 

Resources

No comments:

Post a Comment