Re: set handle to NULL
Kevin Rosenberg <kevin-HJRc7zDS/[email protected]> Wed, 14 Aug 2002 00:49:26 -0600
| Newsgroups | gmane.lisp.uffi.general |
|---|---|
| Message-ID | <[email protected]> |
On Wed, Aug 14, 2002 at 02:22:49AM -0400, John DeSoi wrote:
> (setf newdb (uffi:allocate-foreign-object :pointer-void))
> (setf (uffi:deref-pointer newdb) 0)
Actually, allocate-foreign-object will allocate an object and then
return a pointer to the object. So you want
(setf newdb (uffi:allocate-foreign-object :int))
(setf (uffi:deref-pointer newdb) 0)
Then pass newdb (which is a pointer) to your function.
> (uffi:def-foreign-type isc-db-handle :pointer-void)
Perhaps you need to do something like
(uffi:def-foreign-type isc-db-handle (:array :byte 4)) to setup a
4-byte storage area. I know, kinda ugly, (I didn't test this.)
(Maybe there should be a new primitive type, like :pointer, that
allocates a 4-byte array.
> (setf newdb (uffi:allocate-foreign-object (:pointer isc-db-handle))
Try,
(setf newdb (uffi:allocate-foreign-object isc-db-handle))
Then
(setf (uffi:deref-pointer newdb) 0)
like above
(You can also try setting to zero using your original def-foreign-type
of :pointer-void and see if that works)
--
Kevin Rosenberg | .''`. ** Debian GNU/Linux **
http://b9.com/debian.html | : :' : The universal
GPG signed and encrypted | `. `' Operating System
messages accepted. | `- http://www.debian.org/
signature.asc
(application/pgp-signature, 232 B)
-----BEGIN PGP SIGNATURE----- Version: GnuPG v1.0.6 (GNU/Linux) Comment: For info see http://www.gnupg.org iD8DBQE9Wf12ES7N8sSjgj4RAljXAJ4/6YYOmtjBUOfOHSMZ2ouVtQdowACfV/el 0mnnNbWxhPPVjMjgV1RL4Tg= =IHXd -----END PGP SIGNATURE-----