Cocoa / Objective-C Collision Plugin

My application has a plugin system that allows my users to write their own plugins that load at runtime. This is usually normal, but in some cases the two plugins use the same libraries that will cause a collision between the two.

Example:

Plugin A wants to use TouchJSON to work with JSON, and thus, the creator adds TouchJSON code to the plugin source, and it compiles and binds to the plugin binary. Later, Plug-in B also wants to use the same library and does the same. Now, when my application downloads these two different plugins, it detects this and issues a warning similar to this:

The CJSONScanner class is implemented in both [path_to_plugin_a] and [Path_to_plugin_b]. One of the two will be used. Which one is undefined.

Since my application just downloads the plugins and ensures that they conform to a specific protocol, I can’t control which plugins are loaded and if two or more use the same library.

As long as both plugins use the same version of the library, this will probably work, but as soon as the API changes in one plugin, there will be many problems.

What can I do about it?

+5
source share
2 answers

. , , , . (, ).

.

, - IPC, NSDistantObject, . , , , , , , .

+4

, (, Objective-C). :

  • .
  • , , ( NSClassFromString()). NSClassFromString(), .

, , . , , , , ; , , , , Info.plist.

+2

All Articles