loadlib opcode

Andrew Whitworth wknight8111 at gmail.com
Sat Apr 14 18:09:18 UTC 2012


When the loadlib opcode fails, it returns Undef but provides no other
information about why it failed. There is also no way to manually call
dlerror() to find out why we've gotten an undef. For comparison, the
dlfunc and dlvar opcodes call Parrot_warn() with the information from
dlerror and then returns Undef. I'm not sure I think this behavior is
any more sane, especially when warnings are turned off.

I think we have three options that I can see:
1) Always throw an exception from loadlib, dlfunc and dlvar when the
load fails, with the information from dlerror()
2) Add a new opcode to get the value from dlerror and return it in a
STRING (or some other status-bearing object)
3) Add a new set of opcodes which mirror the behavior of loadlib,
dlfunc and dlvar, but throw exceptions instead of returning undef.

Please let me know if you have any preferences.

--Andrew Whitworth


More information about the parrot-dev mailing list