LspLoad: "Unknown command" - and still working

Started by Peter2, August 07, 2013, 03:54:45 PM

Previous topic - Next topic

Peter2

Hi

I started to try LspLoad and Innosetup and made these steps:

- write a Lisp, include the ODCL-code
- the lisp has (simplfied):
Code (autolisp) Select

(princ "hello")
(command "doslib")
(command "opendcl")
(defun c:test ()
   (alert "test)
)

- compiled to "test.VLX"
- Used Innosetup for a package
  -  which copies VLX + LspLoad + OpenDCL runtime files + Doslib to an userdefined folder
  -  creates all registry-entries for "Applications" for (renamed) LspLoad + ODCL + Doslib
  - LOADCTRLS is 4 - command invoke

To make it short - it works, but with a confusing error. Here is my (modified and translated) protocol

Code (autolisp) Select

Command: test     ----> this is my first command
Unknown Command "test"". Press F1 for help.

Command:    ----> here Acad continues without new user-interaction
hello    ----> this is from "princ"
doslib    ----> this is from (command "doslib") plus autoload
DOSLib 9.0.1
Copyright Ã,© 1992-2012, Robert McNeel and Associates

DOSLib Loaded.

Command: opendcl     ----> this is from (command "opendcl")
OpenDCL Runtime loaded

Command:    ----> here ends the first command: everything loaded, nothing started and "unknown command" above

Command: test     ----> this is my second command
4      ----> this is maybe the value of "loadctrls" (4)
Lisp is executed ...


So my questions are:
- Is it correct that the first command reports "unknown" and load everything?
- Is it possible that "first load" and "first execution" is done at the same time?

Thanks

Peter
Peter
ODCL 8.1.... German, AutoCAD 2017 - 2018, Win 7 x64, Win 10

owenwengerd

AutoCAD has to switch between application context (to load the .arx module) and document context (to load the lisp file), and (primarily) for that reason it's not practical to define the command immediately when the LspLoad .arx module loads. Therefore, you should define the LOADCTRLS to load at startup, and either load your entire application at startup as well, or at least load a short lisp file that defines stub commands which load the real application (redefining themselves in the process) the first time the command is used.

Peter2

Quote from: owenwengerd on August 07, 2013, 06:50:45 PM
... or at least load a short lisp file that defines stub commands which load the real application (redefining themselves in the process) the first time the command is used.
Thanks Owen, I will take a look.
Peter
ODCL 8.1.... German, AutoCAD 2017 - 2018, Win 7 x64, Win 10