title: Cocoa/Objective-C Plugins Collisions
body: <p>My application has a plugin system that allows my users to write their own plugins that get loaded at runtime. Usually this is fine but in some cases two plugins use the same libraries that will cause a collision between those two.</p>
  
  <p>Example:</p>
  
  <p><strong>Plugin A</strong> wants to use <em>TouchJSON</em> for working with JSON and thus the creator adds the TouchJSON code to the plugin source and it gets compiled and linked into the plugin binary. Later <strong>Plugin B</strong> also wants to use that same library and does exactly the same. Now when my app loads these two different plugins it detects this and spits out an warning like this:</p>
  
  <blockquote>
    <p>Class CJSONScanner is implemented in
    both [path_to_plugin_a] and
    [path_to_plugin_b]. One of the two
    will be used. Which one is undefined.</p>
  </blockquote>
  
  <p>Since my app just loads plugins and makes sure they conform to a certain protocol I have no control over which plugins are loaded and if two or more use the same library.</p>
  
  <p>As long as both plugins use the exact same version of the library this will probably work but as soon as the API changes in one plugin a bunch of problems will arise.</p>
  
  <p>Is there anything I can do about this?</p>