Re: Alternative to copy-in/copy-out?
Kevin Rosenberg <kevin-HJRc7zDS/[email protected]> Wed, 23 Oct 2002 09:35:35 -0600
| Newsgroups | gmane.lisp.uffi.general |
|---|---|
| Message-ID | <[email protected]> |
Liam M. Healy wrote:
> When using the ACL interface I could directly pass CL objects to and
> from foreign code. I am looking for the analogue in UFFI.
> In c-test-fns.lisp there is a function
Yes, ACL does have an efficiency there.
> (defun t2 ()
> (let ((vec (make-array +double-vec-length+ :element-type 'double-float)))
> (dotimes (i +double-vec-length+)
> (setf (aref vec i) (coerce i 'double-float)))
> (half-double-vector +double-vec-length+ vec)
> vec))
> does, and is much simpler, and should be more efficient. However,
> it doesn't work for me.
t2 is non-portable, that's why it is not included in the actual
testing. On what platform does it fail, ACL?
As you can see in the code, there is also t3 which is an attempt to
doing somethin similar in cmucl.
I don't know if Lispworks or OpenMCL have an implementation specific
way of avoiding the copy-in and copy-out.
> Is there a way to avoid copy-in and copy-out when making foreign
> calls through UFFI?
At this point, there is not a portable way across all 7 supported UFFI
implementations (ACL, LW, SBCL, CMUCL, SCL, OpenMCL, MCL) to do this.
As you can see from the t3 code, for CMUCL & SCL it is faily
complicated to do this.
At some point, UFFI could be extended to wrap this functionality
around each implementation's method.
Is ACL your primary platform? If so, maybe you can make the majority
of your code plain UFFI, but then we can work together on a work
around where you can have a #+allegro in your code that handles ACL
specific optimizations and then #-allegro which does it via
copy-in/copy-out.
--
Kevin Rosenberg | .''`. ** Debian GNU/Linux **
http://b9.com/debian.html | : :' : The universal
GPG signed and encrypted | `. `' Operating System
messages accepted. | `- http://www.debian.org/