From: timsuth@... (Tim Sutherland) Date: 2004-11-24T17:58:01+09:00 Subject: Re: Ruby DL::Importable struct issue In article , Kevin Howe wrote: >>>I get the following error >>>(eval):2 in '[]': unsupported type 'p' (DL::DLTypeError) >>> from (eval):2:in 'bp' > >> Try "char* bp" or "unsigned char* bp". > >"char* bp" produces the same error, but with type 's' instead of type 'p'. >"unsigned char*" produces an "invalid element" error. I also tried "uint* >bp" and "int* bp", but they give the same original error. Okay, this is a bug in newer versions of the dl extension. e.g. current CVS ruby/ext/dl/sample/libc.rb fails with 10 true false "ab" (eval):5:in `call': unsupported type `p' (DL::DLTypeError) from (eval):5:in `qsort' from libc.rb:62 $ ruby -v ruby 1.9.0 (2004-11-24) [i686-linux] There are a couple of places in ptr.c which do a `switch' on the type ('I', 'S' etc.) but only handle upper-case types like 'P' and not lower-case like 'p' (the latter are the pointer versions). `rb_dlptr_aref' and `cary2ary' in particular.