[LLVMdev] Shared libs?

B. Scott Michel scottm at aero.org
Wed Jun 11 13:32:08 PDT 2008


Thomas Hudson wrote:

>On Jun 8, 2008, at 9:36 PM, Eli Friedman wrote:
>  
>
>>If you'd like to elaborate on why exactly you need shared libs, you
>>might get a better answer.
>>
>>    
>>
>Because I'm writing an extension to a scripting language interpreter.  
>Perl/Python/Ruby all need to be able to dynamically load the library  
>when the user 'requires' or 'imports' the extension.
>
>Obviously I can write a C wrapper which references LLVM and links it  
>as a shared object. But it might be nice to issue a warning when  
>someone uses the "--enable-shared" flag, or perhaps remove it if it is  
>not supported. Or at least put something on the web site that Google  
>would find. :-)
>  
>
"--enable-shared" is dangerous because no one really has thought out the
shared library structure. That's not to say that shared libraries are
evil, but as Chris Lattner pointed out, they can be too finely grained
(every library is a shared library) or too coarsely grained (LLVM is
nothing but a shared library). But if you're looking to integrate into a
scripting language, generating a shared library needs to be there. How
much or how little LLVM you need is _the_ question that needs answering.
For example, clearly, you wouldn't want the SPARC or Arm or MIPS code
generators polluting your shared library load space at runtime, but the
infrastructure to load code generators on-demand isn't there.


-scooter
 "And swiftly and software, the dungeon master said, 'Roll for
initiative.'" :-)




More information about the llvm-dev mailing list