I've just recently come across a strange issue where the MySQL interface in the
SQLClient library had stopped working with a weird error when using the
libobjc2 runtime. In particular, the code was complaining that the
backendQuery:recordType:listType: method was called without a loaded bundle. A
debugging session later it was clear that the MySQL backend bundle was actually
loaded into the program and that the backendQuery:recordType:listType: was
available inside the bundle, but that the runtime simply refused to call the
override and just called the implementation in the SQLClient base class
instead, which emits the error message.
A more careful look at the code revealed a subtle difference between the
definition of the backendQuery:recordType:listType: method in the SQLClient
class and its MySQL bundle subclass: While the former (and all other backend
bundles) uses id parameters for the record and list type arguments, the MySQL
bundle was using Class parameters instead. This resulted in slightly different
method signatures (@40@0:8@16@32 vs. @40@0:8#16#32 on a 64-bit architecture)
and the libobjc2 method dispatch apparently is rather picky about those
signatures. As I've already changed the SQLClient library to use consistent
types, I've condensed the issue into a little test program (Test1.m) below. The
output for this on macOS with Apple's Foundation looks like this (and for
GNUstep with gcc and the gcc runtime it looks similar):