[Ecls-list] Defconstant impossible with ffi?

Juan Jose Garcia-Ripoll juanjose.garciaripoll at gmail.com
Thu Dec 13 16:18:36 UTC 2012


http://clhs.lisp.se/Body/m_defcon.htm

DEFCONSTANT has compile-time side effects. Unfortunately C-INLINE cannot be
evaluated at compilation time because it cannot be interpreted.


On Thu, Dec 13, 2012 at 4:17 PM, Peter Enerccio <enerccio at gmail.com> wrote:

> Hello,
>
> I am trying to compile file containing only this:
>
> (DEFCONSTANT +SDL_HWSURFACE+
>   (FFI:C-INLINE () () :INT "SDL_HWSURFACE" :ONE-LINER T :SIDE-EFFECTS NIL))
>
> however, I get
>
> > (compile-file "test.lisp")
>
> ;;;
> ;;; Compiling test.lisp.
> ;;; OPTIMIZE levels: Safety=2, Space=0, Speed=3, Debug=0
> ;;;
> ;;; Error:
> ;;;   in file test.lisp, position 0
> ;;;   at (DEFCONSTANT +SDL_HWSURFACE+ ...)
> ;;;   * The form (PROGN (SI:*MAKE-CONSTANT '+SDL_HWSURFACE+ (FFI:C-INLINE
> NIL NIL :INT "SDL_HWSURFACE" :ONE-LINER T :SIDE-EFFECTS NIL))
> (SI::REGISTER-GLOBAL '+SDL_HWSURFACE+)) was not evaluated successfully.
> ;;; Error detected:
> ;;; The special form c-inline cannot be used in the interpreter: (NIL NIL
> INT SDL_HWSURFACE ONE-LINER T SIDE-EFFECTS NIL)
>
>
> Why is that? The file is compiled, not evaluated. Also, I tried to put it
> around eval-when with only :compile-toplevel option and it still failed.
>
> --
> Bc. Peter Vaňušanik
> http://www.bishojo.tk
>
>
>
> ------------------------------------------------------------------------------
> LogMeIn Rescue: Anywhere, Anytime Remote support for IT. Free Trial
> Remotely access PCs and mobile devices and provide instant support
> Improve your efficiency, and focus on delivering more value-add services
> Discover what IT Professionals Know. Rescue delivers
> http://p.sf.net/sfu/logmein_12329d2d
> _______________________________________________
> Ecls-list mailing list
> Ecls-list at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/ecls-list
>
>


-- 
Instituto de Física Fundamental, CSIC
c/ Serrano, 113b, Madrid 28006 (Spain)
http://juanjose.garciaripoll.googlepages.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.common-lisp.net/pipermail/ecl-devel/attachments/20121213/20179e13/attachment.html>


More information about the ecl-devel mailing list