Generally if you’re trying to interact with a DLL manually with proc handles and the likes, you only really want to deal with a handful (or better still, one/two) bridges between the two libraries.
If you actually link to the object then you can let the compiler deal with most of this gubbins
Perhaps you could post what your intention is? It’s possible there’s a simpler way forward