Hi David,
> Am 20.01.2021 um 18:15 schrieb David Chisnall <[email protected]>:
>
> For reference, the $_OBJC_CLASS symbols are meant to be exported from a DLL,
> they are the canonical pointers to the classes. The $_OBJC_REF_CLASS
> pointers are private to a library and are the pointer that code should use
> for references to a given class. These are initialised to the corresponding
> $_OBJC_CLASS variables and the runtime can update them to something different
> if we change the structure of the class structure in a future ABI.
Thanks for the clarification, that’s helpful. I tried defining the symbols as
"constant" in the module definition file, and that somehow fixed the linker
error:
EXPORTS
$_OBJC_CLASS_Test CONSTANT
$_OBJC_REF_CLASS_Test CONSTANT
This was totally by chance, but if I understand it correctly this means an
undecorated version (without "_imp_" prefix) is emitted to the import library:
https://docs.microsoft.com/en-us/cpp/build/importing-using-def-files?view=msvc-160
There’s one more issue though: both [Test class] and [Test new] (with "Test"
being defined in the DLL) only return null pointers in my testing. However
subclassing the Test root class locally works fine and allows instantiating the
subclass, as does a locally defined root class (same implementation as Test).
The following code (with "Sub" being a subclass of "Test"):
printf("%p %p\n", [Test class], [Test new]);
printf("%p %p\n", [Sub class], [Sub new]);
Prints:
0000000000000000 0000000000000000
00007FF73EDB0080 00000291D99247A8
Any idea? All other things I tried so far seemed to be working fine, though I’m
sure this won’t be the last of my questions...
Frederik