2007-06-23 15:53 UTC
I understand the benefit of providing demand loading to general consumers of OpenDCL but what's the benefit of calling (command "opendcl") or (vl-cmdf "opendcl") from a loader program, e.g. (_Load_ODCL_Runtimes) rather than explicilty loading the arx file?
In other words, is it being invoked merely because it's available or because it's better than explicit loading?
To illuminate, is this --
Better than this --
?
Also, since demand loading may not be enabled one cannot omit the explicit loading anyway, so I'm thinking I'll probably go the latter.
Thoughts?
Thanks!
Michael.
:)
In other words, is it being invoked merely because it's available or because it's better than explicit loading?
To illuminate, is this --
(defun _Load_ODCL_Runtimes ( )
;; If ObjectDCL is already loaded return T, otherwise
;; attempt to load (return T on successful load, else
;; print an appropriate message; return nil).
(or
;; Already loaded, no need to do anything else.
dcl_getversionex
;; Attempt to demand-load the runtimes.
(if (< 1 (getvar "demandload"))
( (lambda ( / cmdecho )
(setq cmdecho (getvar "cmdecho"))
(setvar "cmdecho" 0)
(vl-catch-all-apply 'vl-cmdf '("opendcl"))
(setvar "cmdecho" cmdecho)
dcl_getversionex
)
)
)
;; Still not loaded, attempt to load the runtimes explicitly.
( (lambda ( / proc_arch arxname arxpath )
;; Determine the appropriate arx module for
;; the processor and the AutoCAD version.
(setq arxname
(strcat "OpenDCL"
(if
(and
(setq proc_arch
(getenv "PROCESSOR_ARCHITECTURE")
)
(< 1 (strlen proc_arch))
(eq "64"
(substr
proc_arch
(1- (strlen proc_arch))
)
)
)
".x64."
"."
)
(substr (getvar "acadver") 1 2)
".arx"
)
)
;; What was the result?
(cond
( (null (setq arxpath (findfile arxname)))
(princ (strcat "Couldn't find " arxname ".\n"))
nil
)
( (null (arxload arxpath nil))
(princ (strcat "Failed to load " arxname ".\n"))
nil
)
( t ) ;; We're good.
)
)
)
)
)Better than this --
(defun _Load_ODCL_Runtimes ( )
;; If ObjectDCL is already loaded return T, otherwise
;; attempt to load (return T on successful load, else
;; print an appropriate message; return nil).
(or
;; Already loaded, no need to do anything else.
dcl_getversionex
;; Not loaded, attempt to load the runtimes explicitly.
( (lambda ( / proc_arch arxname arxpath )
;; Determine the appropriate arx module for
;; the processor and the AutoCAD version.
(setq arxname
(strcat "OpenDCL"
(if
(and
(setq proc_arch
(getenv "PROCESSOR_ARCHITECTURE")
)
(< 1 (strlen proc_arch))
(eq "64"
(substr
proc_arch
(1- (strlen proc_arch))
)
)
)
".x64."
"."
)
(substr (getvar "acadver") 1 2)
".arx"
)
)
;; What was the result?
(cond
( (null (setq arxpath (findfile arxname)))
(princ (strcat "Couldn't find " arxname ".\n"))
nil
)
( (null (arxload arxpath nil))
(princ (strcat "Failed to load " arxname ".\n"))
nil
)
( t ) ;; We're good.
)
)
)
)
)?
Also, since demand loading may not be enabled one cannot omit the explicit loading anyway, so I'm thinking I'll probably go the latter.
Thoughts?
Thanks!
Michael.
:)