title: Plugin architecture in C using libdl
body: <p>I've been toying around, writing a small IRC framework in C that I'm now going to expand with some core functionality - but beyond that, I'd like it to be extensible with plugins!</p>
  
  <p>Up until now, whenever I wrote something IRC related (and I wrote a lot, in about 6 different languages now... I'm on fire!) and actually went ahead to implement a plugin architecture, it was inside an interpreted language that had facilities for doing (read: abusing) so, like jamming a whole script file trough <code>eval</code> in Ruby (bad!).</p>
  
  <p>Now I want to abuse something in C!</p>
  
  <p>Basically there's three things I could do</p>
  
  <ol>
  <li>define a simple script language inside of my program</li>
  <li>use an existing one, embedding an interpreter </li>
  <li>use libdl to load *.so modules on runtime</li>
  </ol>
  
  <p>I'm fond of the third one and raather avoid the other two options if possible. Maybe I'm a masochist of some sort, but I think it could be both fun and useful for learning purposes.</p>
  
  <p>Logically thinking, the obvious "pain-chain" would be (lowest to highest) 2 -> 1 -> 3, for the simple reason that libdl is dealing with raw code that can (and will) explode in my face more often than not.</p>
  
  <p>So this question goes out to you, fellow users of stackoverflow, do you think libdl is up to this task, or even a realistic thought?</p>