[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
MacOS mzc --embedded problems
Quoting Patrick Hertelendy:
> I tried compiling a scheme source file with mzc and the -o and -embbeded flags
> with CodeWarrior 4.0 on a powermac.
> I get the following errors: is there something wrong in the scheme
> source file or with CodeWarrior?
>
> [...]
>
> Error : data type is incomplete
> Arinetbuild1.c line 687 Scheme_Object * _consts_[0];
In this case, I'll be the compiler doesn't like zero-sized arrays.
Indeed, mzc isn't supposed to emit them, and I see the bug.
You can hack around the problem by including a string in your source
file (somewhere that won't get optimized away).
To actually fix the problem, change `emit-static-variable-fields!' in
plt/collects/compiler/vm2c.ss, line 168, so that it does nothing when
it's given an empty list:
(define (emit-static-variable-fields! port l)
(unless (null? l) ; <<<< ADDED <<<<<
(fprintf port " /* Write fields as an array to help C comiplers */~n")
...))
> Error : undefined identifier 'scheme_fuel_counter'
> Arinetbuild1.c line 10271 { if ((scheme_fuel_counter -= 1) <= 0)
> scheme_process_block(0); }
This is a bug in the MzScheme header files. It's specific to platforms
that use MzScheme's manual linking table (MacOS is such a platform).
It's also specific to compiling for embedding.
I've fixed the header for the next release. In line 824 in the file
plt/collects/mzscheme/include/scheme.h, the lines
#if !SCHEME_DIRECT_EMBEDDED
# ifndef MZ_REAL_THREADS
# ifdef LINK_EXTENSIONS_BY_TABLE
# define scheme_fuel_counter (*scheme_fuel_counter_ptr)
# endif
# endif
#endif
should be
#ifndef MZ_REAL_THREADS
# if !SCHEME_DIRECT_EMBEDDED
# ifdef LINK_EXTENSIONS_BY_TABLE
# define scheme_fuel_counter (*scheme_fuel_counter_ptr)
# endif
# else
extern int scheme_fuel_counter;
# endif
#endif
Hope that helps,
Matthew
- References:
- No Subject
- From: Patrick Hertelendy <Patrick.Hertelendy@unifr.ch>