MochiLibraries / Biohazrd

A framework for automatically generating binding wrappers for C/C++ libraries
MIT License
60 stars 8 forks source link

Remove WrapNonBlittableTypesWhereNecessaryTransformation and make NativeBoolean/NativeChar an output implementation detail #200

Closed PathogenDavid closed 2 years ago

PathogenDavid commented 3 years ago

Edit: Decided this was extra double-plus annoying and decided to quickly fix it using the first option described below.

However this has revealed that NativeBoolean/NativeChar are a bit of an annoying edge case to be handled. We should consider the second option below to make it so that we don't generally have to worry about them.


An unfortunate side-effect of https://github.com/InfectedLibraries/Biohazrd/issues/147 is that we can't use NativeBoolean on the vtable pointer type and bool on the corresponding TranslatedFunction.

Ideally we'd use NativeBoolean for the vtable pointer but bool for the trampoline. However doing that is somewhat more complex now.

There's multiple ways to handle this and I'm not sure which I want to go with so I'm deferring this for the time being since it's not a huge deal. As a workaround I'm going to modify WrapNonBlittableTypesWhereNecessaryTransformation to always wrap bool/char on virtual methods.