Slightly tangential, and while I know nothing about the implementation details of the SQLPAL, the SSCLI (and later CLR/CoreCLR) took the same approach to port Windows based code to Unixes [1] and makes for interesting code reading. For e.g. The SSCLI PAL's implementation of SEH [2].