Accessing External ObjectARX Functions from a Separate-Namespace VLX
 
 
 

In order to access functions that are defined in an external ObjectARX application from a separate-namespace VLX, you must first issue vl-arx-import to import the function. ObjectARX functions are identified as data type EXRXSUBR. For example, the following command identifies startapp as an external ObjectARX function:

Command: (type startapp)

EXRXSUBR

The following function works correctly if loaded from an LSP file:

(vl-doc-export 'StartApp2)
(vl-load-com)


(defun StartApp2 ()
   (setq acadApp (vlax-get-acad-object))
   (setq acadDoc (vla-Get-ActiveDocument acadApp))
   (setq acadPrefs (vla-Get-Preferences acadApp))
   (setq acadPrefFiles (vla-get-Files acadPrefs))
   (setq hlpFile (vla-Get-HelpFilePath acadPrefFiles))
   (startapp "winhlp32" hlpFile)
   (princ)
)
(princ "\nStartApp2 is loaded, Type (StartApp2) to Run.")
(princ)

However, if you compile StartApp2 as a separate-namespace VLX and try to run the function, it fails with the following error message:

"no function definition: STARTAPP"

To correct this, import startapp using the vl-arx-import function, as shown in the following revised code:

(vl-doc-export 'StartApp2)
(vl-load-com)
(vl-arx-import 'startapp)


(defun StartApp2 ()
   (setq acadApp (vlax-get-acad-object))