comparison lispref/internals.texi @ 10487:9a4ff0104cdc

entered into RCS
author Richard M. Stallman <rms@gnu.org>
date Fri, 20 Jan 1995 00:57:39 +0000
parents 4d87344e6dfb
children 311f3ea4a759
comparison
equal deleted inserted replaced
10486:0028c532b70b 10487:9a4ff0104cdc
501 These macros implicitly use local variables such as @code{gcpro1}; you 501 These macros implicitly use local variables such as @code{gcpro1}; you
502 must declare these explicitly, with type @code{struct gcpro}. Thus, if 502 must declare these explicitly, with type @code{struct gcpro}. Thus, if
503 you use @code{GCPRO2}, you must declare @code{gcpro1} and @code{gcpro2}. 503 you use @code{GCPRO2}, you must declare @code{gcpro1} and @code{gcpro2}.
504 Alas, we can't explain all the tricky details here. 504 Alas, we can't explain all the tricky details here.
505 505
506 Remember that you must never initialise external variables (whether 506 You must not use C initializers for static or global variables unless
507 static or not). If you do that, the linker will put the variable into 507 they are never written once Emacs is dumped. These variables with
508 the initialised data area of the process, which on many architectures 508 initializers are allocated in an area of memory that becomes read-only
509 becomes read-only when emacs is dumped (@pxref {Pure Storage}). 509 (on certain operating systems) as a result of dumping Emacs. @xref{Pure
510 510 Storage}.
511 Remember also that the keyword @code{static} is defined as nothing on 511
512 many architectures whose linkers would put every static variable in the 512 Do not use static variables within functions---place all static
513 initialised data area, which becomes read-only after dumping. This 513 variables at top level in the file. This is necessary because Emacs on
514 means that you must never use static local variables, because on those 514 some operating systems defines the keyword @code{static} as a null
515 architectures they would lose the @code{static} specifier and become 515 macro. (This definition is used because those systems put all variables
516 automatic. Use static external variables instead. 516 declared static in a place that becomes read-only after dumping, whether
517 they have initializers or not.)
517 518
518 Defining the C function is not enough to make a Lisp primitive 519 Defining the C function is not enough to make a Lisp primitive
519 available; you must also create the Lisp symbol for the primitive and 520 available; you must also create the Lisp symbol for the primitive and
520 store a suitable subr object in its function cell. The code looks like 521 store a suitable subr object in its function cell. The code looks like
521 this: 522 this: