I have to use a third-party library into one of my OSX applications. The app itself will be in Swift, but the compiled library exposes what seems to be Objective-C++ functions through a header.
It should normally only require a bridging header, but I have strange errors concerning some functions in the library-provided .h
when included in my bridging one:
+ (const char *)funcName:(const aStructType &)something;
This line (which looks like most lines in the .h) for example generates two errors:
Must use 'struct' tag to refer to type 'aStructType'
and
Expected ')'
The first error refers to the struct type and the second one to the ampersand.
I first tried to make an Objective-C Bridge as suggested by previous answers on SO (with the .h included in the .mm), but the many conflicting types quickly became a mess and caused too many compile errors. Furthermore delegate patterns became impossible to work with and translate to Swift while avoiding any type from the framework.
My second solution was to simply correct the header by hand for testing purposes, changing the example line before to this:
+ (const char *)funcName:(const struct aStructType)something;
It worked and data was coming through, but structures where apparently broken by what seems to be a number type issue. Nevermind the fact that it just seems absolutely insane to simply change a header.
The library seems to works just fine with Objective-C++ code only app, so i'm not sure where the issue is coming from.
I tried to stay pretty generic, but let me know if you need more detail on the framework itself!
Thanks!