Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2024-11

Namespace collisions

2 messages · 2 people ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Adriaan van Os

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 ?

Regards,

Adriaan van Os

Reply by email

Jonas Maebe
to Adriaan van Os
Adriaan van Os wrote 24 lines
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

Reply by email