"Jeff Mishler" wrote
> Would you care to share so I might learn? In all of the posts with this, or
> similar, question, I have not seen any response from you, or anyone else, as
> to how this may be done.
>
> Say I have my "xtraspecial.lsp" that I have been using since Eisenhower was
> president, it works great and sets a global var named "*xtra_spcl_var*" that
> contains a list of dotted pairs. How can I access the data in this var in my
> new VBA project?
You can't bring an association list across, because it has
no ActiveX counterpart. A simple list of ActiveX-compatible
data types can be fetched as a safearray wrapped in a
variant, but forget about directly accessing association lists.
In general, directly exposing variables to other modules in
the same or other languages, has never been considered
a sound practice, regardless of other complications.
My objection to the kludge-o-rama approach that got me
started in this, is that it embraces the unsound practice
of directly exposing private member variables (or global
LISP variables) to another API. Regardless of whether you
are passing data between LISP and VBA, or not, you don't
do it by attempting to directly manipulate variables in one
environment from another. Instead, you define a formal
interface consisting of functions that can be called from
one environment, to manipulate data in the other.
So, You can define a LISP functoin that takes a key and
calls (assoc) and (cdr) to get a value from the association
list, and returns it to its caller. That function can serve as
the 'external' interface to the association list, in the same
way that you write property get/let functions in VBA, rather
than directly exposing an underlying member variable.
See the attached files. From the command line, load the
LISP file and the VBA module, and call the two public
subs in the latter from the VBARUN command.
Then, from the command line, inspect the value of the
LISP association list.
--
http://www.caddzone.com
AcadXTabs: MDI Document Tabs for AutoCAD 2004/2005
http://www.acadxtabs.com