[pypy-dev] rffi strict typing
simon at arrowtheory.com
Thu Aug 23 00:23:40 CEST 2007
On Fri, 20 Jul 2007 14:52:54 +0200
Armin Rigo <arigo at tunes.org> wrote:
> Hi Simon,
> On Thu, Jul 19, 2007 at 06:31:17PM -0700, Simon Burton wrote:
> > The lltype's are very strict about types.
> Indeed, it seems worthwhile to loosen this restriction at least for the
> purpose of calling external functions... Not sure how, but there are
> possible hacks at least.
Following some hints from Samuele, I am trying to wrap such functions in
another function that does some casting.
Here is my first attempt. It does no casting, but i already can't get it
def softwrapper(funcptr, arg_tps):
unrolling_arg_tps = unrolling_iterable(enumerate(arg_tps))
real_args = tuple([args[i] for i, tp in unrolling_arg_tps])
result = funcptr(*real_args)
where funcptr comes from a call to llexternal.
It seems the tuple construction should not work (each args[i] is a different type), but instead i get:
CallPatternTooComplex': '*' argument must be SomeTuple.
Um.. My only guess now is to malloc a TUPLE_TYPE.. ?!? no idea..
(I am really sick of code generation and hope it doesn't come to that).
More information about the Pypy-dev