On Wed, Jul 12, 2006 at 12:18:51PM -0700, Allison Randal wrote:
> Leopold Toetsch wrote:
> > 
> > Well, there was already one very legitimate usage of compile time
> > loadlib, which is now using C<.loadlib> for that:
> 
> We certainly need both compile-time and runtime loading of libraries. 
> So, it's just a question of which syntax to use for which case.
> 
> chromatic suggests .include for "load this library at compile and run 
> time". The .include directive is currently being used to mean "inline 
> the entire source code for this file here". But, I've always thought of 
> that as a hack we put in before we had library loading working. Any 
> thoughts?

C<.include> and C<loadlib> are really very different. It's like #include
and dlopen(3) in the C language. But I can see, what is leading to this
argument: loading arbitrary bytecode within .include, which should better
be done with C<load_bytecode>.

This means, we'd have:

  .include "file.pasm/.pir"  ... load macros or constants (no code)

  load_bytecode "file.pbc"   ... load a "module"

  $P0 = loadlib "file"       ... load a shared lib (pmc or ops) 
  .loadlib "file"            ... same during compilation 

> That would leave us the consistency of the loadlib opcode and the 
> .loadlib directive both meaning "load this library at runtime".

Not really.

> Allison

leo

Reply via email to