Visual Lisp: how to call functions in an external C ++ DLL

I have a C ++ dll that I wrote (native, not.net) and I would like to use its functionality from Visual Lisp. Can someone give me an example of how to do this, or at least which bit of documentation to read?

+8
c ++ dll autocad autolisp
source share
2 answers

I solved this by writing an activex / COM wrapper for my dll, which I think should facilitate its communication in the future. Running the thread in the swamp gave some answers from nice people on how to call COM from Visual Lisp. For the record, it looks something like this:

//in c++... (header and IDL file also needed) hresult timestwo(double in,double* out) { *out = in*2; return S_OK; } ;; in Lisp... (vl-load-com) (setq myinstance (vlax-create-object "mycomwrapperdll.mycomwrapperclass")) (setq num 12.34) (vlax-invoke-method myinstance 'timestwo num 'newnum) (vlax-release-object myinstance) ;; newnum now contains 24.68 
+6
source share

You open your own C ++ code in AutoLisp using the API calls acedDefun () and acedRegFunc ().

This discussion discusses the Autodesk programming forum asking exactly your question.

+4
source share

All Articles