> (Which in itself tickles and scares the bejesus out of me.)  Is there a
> good way of finding the standard C library on a Unix system other than
> hard-wiring it in like this?
Yes. Parrot is linked with the standard C library. You can get a handle for 
the own executable by passing a NULL pointer to dlopen. You can also use this 
handle to call libc functions.
You can not pass a NULL pointer to loadlib at the moment, this small hacks
"converts" an empty string to a NULL pointer to pass it to Parror_dlopen:

  const char * s = 0;

  if( $2->strlen != 0 ) {
    s = string_to_cstring(interpreter, ($2));
  }
  p = Parrot_dlopen(s);

With this hack, the following code will work:

        loadlib P1, ""
        dlfunc P0, P1, "system", "it"
        set I0, 1
        set S5, "ls"
        invoke
        end

cya,
Jens Rieks

Reply via email to