newer 发表于 2021-1-11 20:15:53

ARX function exposure within a separate namespace VLX


问题:
I built a separate namespace vlx from firstasi.lsp, but I cannot connect to
the database with the functions in the loaded asilisp.arx. Why?

解答:
In order to expose a function defined in a loaded ARX application to AutoLISP
code contained in a separate namespace vlx, use the (vl-arx-import) function.

The following AutoLISP code demonstrates how you can use this in a compiled
separate namespace VLX:

(if (member "asilisp.arx" (arx))
(vl-arx-import "asilisp.arx")
(setq
    ASI_LISPVERSION nil
)
)

(defun TestSnspc ()

(if (and (null ASI_LISPVERSION)
           (null (member "asilisp.arx" (arx)))
      )
    (progn
      (arxload "asilisp.arx")
      (vl-arx-import "asilisp.arx")
    )
)

(if (null ASI_LISPVERSION)
    (princ "\nASILisp.ARX was NOT loaded.")
    (princ
      (strcat "\nASI Version (Printing From Separate Namespace) = "
              (ASI_LISPVERSION)
              "\n"
      )
    )
)
(princ)
)

(vl-doc-export 'TestSnspc)

(princ "\nTestSnspc loaded, type (TestSnspc) to Run.\n")
(princ)

You can find additional documentation for vl-arx-import in the AutoCAD 2000
readme file. Also refer to the function description in the AutoLISP Reference:

AutoCAD 2000 Readme -> AutoCAD 2000 Documentation Corrections and Additions
-> VL-ARX-IMPORT Required to Access External ObjectARX Functions from a
Separate-Namespace VLX

Visual LISP Developer's Guide -> Appendix A -- AutoLISP Function Synopsis ->
VLX Namespace Functions

页: [1]
查看完整版本: ARX function exposure within a separate namespace VLX