|
From: | Paolo Bonzini |
Subject: | [Help-smalltalk] Re: C Callbacks |
Date: | Tue, 20 May 2008 16:12:33 +0200 |
User-agent: | Thunderbird 2.0.0.14 (Macintosh/20080421) |
Paolo Bonzini wrote:
Maybe I can reuse the existing parameter stuff around #cCall: for inbound calls.If you want to warm up with that code, you might start converting this part of it to Smalltalk:desc->returnType = classify_type_symbol (returnTypeOOP, true); if (desc->returnType == _gst_nil_oop) goto error; for (i = 1; i <= numArgs; i++) { OOP type; type = desc->argTypes[i - 1] = classify_type_symbol (ARRAY_AT (argsOOP, i), false); if (type == _gst_nil_oop) goto error; } ... together with symbol_type_map, type_map, classify_type_symbol.
Actually, what I meant is that this code is duplicated in C and Smalltalk (kernel/CFuncs.st). It would be interesting to use only the Smalltalk one. To this end, the C primitive VMpr_CFuncDescriptor_create (defined in prims.def and cint.c) should be simplified to just return the address of a C function. Everything else can be done in Smalltalk.
Paolo
[Prev in Thread] | Current Thread | [Next in Thread] |