Search the FAQ Archives

3 - A - B - C - D - E - F - G - H - I - J - K - L - M
N - O - P - Q - R - S - T - U - V - W - X - Y - Z
faqs.org - Internet FAQ Archives

comp.cad.autocad AutoLISP FAQ (part 1/2) - general
Section - [12] How to Autoload my programs?

( Part1 - Part2 - Single Page )
[ Usenet FAQs | Web FAQs | Documents | RFC Index | Cities ]


Top Document: comp.cad.autocad AutoLISP FAQ (part 1/2) - general
Previous Document: [11] S::STARTUP, My LISPs aren't loaded at startup anymore
Next Document: [13] How can I pass a variable number of arguments to a lisp
See reader questions & answers on this topic! - Help others by sharing your knowledge
  How to load my programs automatically? You can either load your
  whole program at startup (see  "[11] My LISP doesn't
  load at startup anymore") which needs more time and memory at
  startup time, or you can define them via the autoloading mechanism.
  From R14 on ARX programs use a new autoloading scheme (called
  "demand loading") with some registry settings and not from ACADRxx.LSP
  anymore.

  Look at the end of your ACADRxx.LSP how AutoCAD autoloads its programs.

  ;;;===== AutoLoad LISP Applications =====
  ...
  (autoload "dline" '("dline" "dl"))
  ...

  This defines the commands DLINE and DL in the list to be loaded
  from the file DLINE.LSP when the user first calls the command DLINE
  or DL. Before that the function is simply defined like this one:

  (defun C:DL () (load "DLINE")(C:DL))

  In fact the definition is more complicated because of error
  handling.
  After the first call the function is overwritten with the
  definition in the program.

  Advantages of autoloading:
  * Startup is faster, because you dont have to load all your lisp
    files. You just define the simple *wrapper* definition as above.
    This is done by the (autoload) function.
  * You need less memory.

  Disadvantages:
  * On errors in your program you will fall into a never ending
    loop, which will only stop after a stack overflow or Ctrl-C
    Note: with ACOMP compiled code even Ctrl-C is impossible.
      Insert then a call to an uncompiled (princ) somewhere.
  * You have to define and maintain all command names from your
    program in the autoloader definition. Changes to the lisp
    filename or the command name will cause the above error.

  Where to put your (autoload) definitions?

  * Not to ACADR13.LSP.
  * Well we recommend putting it to an initialization file of yours
    and not to ACAD.LSP because this is often changed by different
    applications and ACAD.LSP should be kept rather small.
      I.e. put it to a AUTOLOAD.LSP or INIT.LSP, which is loaded from
    ACAD.LSP. See "[11] My LISP doesn't load at startup anymore"
  * It should be mentioned that users should *not* modify ACADRxx.LSP.
    Since ACAD.LSP is not overwritten during upgrades, it is guaranteed
    to remain safe. In addition (as we saw with the R13c4a patch) if the
    ACADR13.LSP file has been  modified, then the patch process may
    refuse to update it, thus resulting in program malfunctions.

User Contributions:

Comment about this article, ask questions, or add new information about this topic:

CAPTCHA




Top Document: comp.cad.autocad AutoLISP FAQ (part 1/2) - general
Previous Document: [11] S::STARTUP, My LISPs aren't loaded at startup anymore
Next Document: [13] How can I pass a variable number of arguments to a lisp

Part1 - Part2 - Single Page

[ Usenet FAQs | Web FAQs | Documents | RFC Index ]

Send corrections/additions to the FAQ Maintainer:
rurban@xarch.tu-graz.ac.at (Reini Urban)





Last Update March 27 2014 @ 02:11 PM