2 ms·
Maybe I am missing something, but if the goal is to connect to C-based plugin interface using C++, what's with the simple approach of writing a C wrapper for ea
by theamk 4y ago
Maybe I am missing something, but if the goal is to connect to C-based plugin interface using C++, what's with the simple approach of writing a C wrapper for each C++ function? Then one has a single global/static variable of type "basic_plugin" with virtual methods, and the "onload" method creates either basic_plugin or extended_plugin instance, depending on where it is defined.
That said, libffi's closure API is super neat! This approach was very popular in Borland's Delphi/C++ builder products and their VCL library, and when I moved to regular C/C++, I missed it. Nice to know that this function is still available if I ever need it.