On 07/11/2024 16:27, Adriaan van Os via fpc-pascal wrote:
In ObjectiveC we have the infamous namespace collision problem. I am wondering how this applies to Objective Pascal.

For example, I have a plugin, written in Pascal, with only one global external symbol, the plugin entry point

000000000000a6d0 (__TEXT,__text) external _MyPluginEntryPoint

But the plugin uses Cocoa internally, e.g. to declare an NSApplicationDelegate. This ends up in the plugin code as a non-global symbol, e.g.

000000000006aa80 (__TEXT,__text) non-external (was a private external) -[NSApplicationDelegate application:openFile:]

And I have another plugin that does the same. So, there are two non-global symbols like this

000000000006aa80 (__TEXT,__text) non-external (was a private external) -[NSApplicationDelegate application:openFile:]

Does the namespace collision problem apply now ? or only to symbols that are global external symbols ? Is this different in Objective Pascal from Objective C ?

It works exactly the same in Objective Pascal as in Objective C, as this is defined by the Objective C ABI. Since that one is completely name-based, any time you define two classes with the same name you have a potential problem, in the sense that it is unpredictable which one will be used at run time.


Jonas
_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Reply via email to