#lang scribble/doc @(require scribble/manual) @title{Sizeof} Uses the C compiler and preprocessor to find the size of arbitrary C types. Yes, seriously. Caches results as much as possible, in bytecode, in memory, and as various 'librarylets' in ~/.plt-scheme/sizeof/. Pretty much all you do is @scheme[(sizeof "ctype" "include" "include" ...)] where "ctype" is the compiler's string representation of the type you want, and each "include" is the relative file name of an include file, minus the .h suffix. Since you're only getting the size of possibly macros, possibly typedefs, possibly structs, you should only need to specify include files, and not any additional C code. You cannot get the size of a type whose string representation is stored in a variable. This is because sizeof is implemented as a macro, in order to generate platform specific bytecode. If you really need to have something like @scheme[(sizeof (read))], then use procedural.ss which provides the procedure that the syntax transformer in main.ss uses to calculate what syntax to insert for what type expression. It's kind of like: @schemeblock[(require synx/sizeof) (sizeof "time_t" "sys/time")] versus @schemeblock[(require synx/sizeof/procedural) (let ([type "time_t"]) (sizeof type "sys/time"))] Obviously a syntax can't predict what a variable is going to be when that variable isn't calculated until phase 2. The latter seems more attractive, but when you use mzc on the former, it will call the latter procedure during the compilation, and when you run mzscheme on the compiled code it won't run any procedure at all, but simply have the right numbers it calculated during compilation.