[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: troubles with .zo and macro



Quoting "olivier MERIGON":
> I've made an application that works, then I wanted to compile it
> into byte code and I have got  some troubles.
> 
> This is the main file:
> ; load commands
> (load/use-compiled (build-path "param.scm"))
> (load/use-compiled (build-path "matrix4.scm"))
> [...]
> 
> It works perfectly with not-compiled files, but using .zo I've
> this error when loading "matrix4.zo":
> -->"reference to undefined identifier: set-matrix4"
> 
> set-matix4 is a macro [...]

The compiler doesn't perform the `load/use-compiled's when it compiles
the main file. Instead, it just compiles each `load/use-compiled'
expression. Consequently, the macro `set-matrix4' is not defined when
the compiler processes the rest of the file.

In version 199.X, the solution is to use `module'.

In version 103.X, the solution is more clumsy; add a
`begin-elaboration-time' load for every file that defines both macros
and values:

  (load/use-compiled (build-path "matrix4.scm"))
  (begin-elaboration-time (load/use-compiled (build-path "matrix4.scm")))

For 103.X info, see also

 http://www.cs.rice.edu/CS/PLT/packages/doc/mzc/node11.htm

Matthew