May I use uninterned symbols for functions ?
Is the following safe enough ?
(defmacro def-hello ()
(let ((temp (gensym)))
`(eval-when (:compile-toplevel :load-toplevel :execute)
(ff:def-foreign-call ,temp #|....|#)
(defun hello () (,temp)))))
If this approach has some drawbacks invisible to me please warn me.
Temp function servers internal purposes only. And not intended to be
called directly.
--
Vladimir Zolotykh
In article <·················@eurocom.od.ua>,
Vladimir Zolotykh <······@eurocom.od.ua> wrote:
>May I use uninterned symbols for functions ?
>
>Is the following safe enough ?
>
>(defmacro def-hello ()
> (let ((temp (gensym)))
> `(eval-when (:compile-toplevel :load-toplevel :execute)
> (ff:def-foreign-call ,temp #|....|#)
> (defun hello () (,temp)))))
>
>If this approach has some drawbacks invisible to me please warn me.
>Temp function servers internal purposes only. And not intended to be
>called directly.
I don't think there should be a problem. But why not:
(defmacro def-hello ()
`(eval-when (:compile-toplevel :load-toplevel :execute)
(ff:def-foreign-call hello #|....|#)))
--
Barry Margolin, ······@genuity.net
Genuity, Woburn, MA
*** DON'T SEND TECHNICAL QUESTIONS DIRECTLY TO ME, post them to newsgroups.
Please DON'T copy followups to me -- I'll assume it wasn't posted to the group.
Barry Margolin wrote:
>
> I don't think there should be a problem. But why not:
>
> (defmacro def-hello ()
> `(eval-when (:compile-toplevel :load-toplevel :execute)
> (ff:def-foreign-call hello #|....|#)))
Because some manipulations should be done with input and
output parameters of the call. For example
(let ((res (#:1234 ........)))
(case res
(0)
(otherwise (native-to-string res]
in the simples case and so on.
--
Vladimir Zolotykh
Vladimir Zolotykh <······@eurocom.od.ua> wrote in message
······················@eurocom.od.ua...
> May I use uninterned symbols for functions ?
>
> Is the following safe enough ?
>
> (defmacro def-hello ()
> (let ((temp (gensym)))
> `(eval-when (:compile-toplevel :load-toplevel :execute)
> (ff:def-foreign-call ,temp #|....|#)
> (defun hello () (,temp)))))
>
> If this approach has some drawbacks invisible to me please warn me.
> Temp function servers internal purposes only. And not intended to be
> called directly.
One small suggestion I would make: use something like (gensym "hello").
This can be a real time saver when you have a bug in function #:HELLO523
rather than function #:G522
--
Coby Beck
(remove #\Space "coby 101 @ bigpond . com")