MochiLibraries / Biohazrd

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

Add verification step to check whether the inline reference file is necessary #86

Open PathogenDavid opened 3 years ago

PathogenDavid commented 3 years ago

Right now Biohazrd requires the generator author to manually invoke InlineReferenceFileGenerator when a library contains inline methods which aren't exported.

Right now there isn't anything indicating to the generator author that they need to do this, the library simply won't work (you'll get missing export failures.) This is obviously not ideal and we should automatically detect this scenario and inform the generator author they need to create the inline reference file.

Alternatively/additionally, we could automatically build the inline reference file when necessary: https://github.com/InfectedLibraries/Biohazrd/issues/85

Although we still need to make sure we communicate to the generator author that this file needs to be distributed. (I briefly looked into having Biohazrd generate a mixed assembly, but it seems there's 0 support for these outside of Windows since the feature is really only meant to support C++/CLI.

PathogenDavid commented 3 years ago

LinkImportsTransformation makes this significantly less important as it will emit errors that it can't resolve the inline methods. It'd still be nice if we emitted an actionable error with a link to documentation about dealing with inline functions.

PathogenDavid commented 3 years ago

InlineExportHelper also handles the edge case of a non-inline non-method static function found in a header file. These are never found in well-formed C++ libraries, but we should emit a similar warning for them.