By Adam Nagy
When I load my dll then I get this warning:
; User warning: assignment to protected symbol: CLOSE <- #
Also, when loading the dll for the second time, I get similar warnings for all the functions the dll contains.
Shall I just ignore these warnings?
Solution
You can and should avoid these warnings by using prefixes for the imported dll methods/properties/constants.
The best things is to use your registered developer symbol plus m/p/c depending on if it's for methods, properties or constants.
Also you can find out if the dll has already been loaded by checking if any of the methods/properties/constants are available (i.e. does not equal nil), and if they are not, only then load your dll.
Here is a sample code using my registered developer symbol, AEN1:
(defun c:loadmydll ( )
(vl-load-com)
; Check if a specific function that is part of the dll
; if not, then the dll is not yet loaded
; so we load it now
; This specific dll contains a function called close,
; so I'm checking for that
(if (equal nil aen1m-close)
(vlax-import-type-library
:tlb-filename "C:/Test/lispCOM.dll"
:methods-prefix "aen1m-"
:properties-prefix "aen1p-"
:constants-prefix "aen1c-"
)
)
)

Leave a Reply to stemfixerCancel reply