Author Topic: load dll with lisp  (Read 5917 times)

0 Members and 1 Guest are viewing this topic.

tdaniel14

  • Guest
load dll with lisp
« on: January 24, 2008, 11:52:32 PM »
I would like to load a dll with lisp then call a sub that is in the dll. 
I've seen examples of how to call a function from a dll but that's not what I need. 
I am not a lisp programmer and have no idea how to do this.

This is what I have in my dll file:

Filename: myvbprogam.dll
Classmodule: myclass
Sub in Classmodule: myclasssub

I would like to run the myclasssub.

Any help would be greatly appreciated!

MP

  • Seagull
  • Posts: 17750
  • Have thousands of dwgs to process? Contact me.
Re: load dll with lisp
« Reply #1 on: January 25, 2008, 07:40:09 AM »
Perhaps see the lisp code in this post for a start, though as a new swimmer I think you're starting in the deep end of the pool.
Engineering Technologist • CAD Automation Practitioner
Automation ▸ Design ▸ Drafting ▸ Document Control ▸ Client
cadanalyst@gmail.comhttp://cadanalyst.slack.comhttp://linkedin.com/in/cadanalyst

tdaniel14

  • Guest
Re: load dll with lisp
« Reply #2 on: January 25, 2008, 09:24:54 AM »
MP, thanks for your response!  I have tried code similar to this, which calls a function.  What I need it to do is call the sub.  I have not been able to successfully modify the code to accomplish this.

As far as my swimming capabilities, I agree with you.  I do 95% of my programming in VB/VBA.

Thanks

MP

  • Seagull
  • Posts: 17750
  • Have thousands of dwgs to process? Contact me.
Re: load dll with lisp
« Reply #3 on: January 25, 2008, 09:45:16 AM »
See these examples which get / put object (class instance) properties (vlax-get [-property] / vlax-put [-property]) and call object methods (vlax-invoke [-method]) including methods that require arguments.

Regex Example.

Read / Write stream.

Parse CSV string including quoted fields with commas.

... for what it's worth.



Engineering Technologist • CAD Automation Practitioner
Automation ▸ Design ▸ Drafting ▸ Document Control ▸ Client
cadanalyst@gmail.comhttp://cadanalyst.slack.comhttp://linkedin.com/in/cadanalyst

GDF

  • Water Moccasin
  • Posts: 2084
Re: load dll with lisp
« Reply #4 on: January 25, 2008, 11:18:18 AM »
I would like to load a dll with lisp then call a sub that is in the dll. 
I've seen examples of how to call a function from a dll but that's not what I need. 
I am not a lisp programmer and have no idea how to do this.

This is what I have in my dll file:

Filename: myvbprogam.dll
Classmodule: myclass
Sub in Classmodule: myclasssub

I would like to run the myclasssub.

Any help would be greatly appreciated!


If you name the dll file the same as a loaded menu file, it will be automatically loaded. This is what I do for my compiled bitmaps for my toolbars.

Gary
Why is there never enough time to do it right, but always enough time to do it over?
BricsCAD 2020x64 Windows 10x64

MP

  • Seagull
  • Posts: 17750
  • Have thousands of dwgs to process? Contact me.
Re: load dll with lisp
« Reply #5 on: January 25, 2008, 12:42:00 PM »
Another run at trying to help ...



Assuming MyVbProgam is a registered ActiveX dll

AND

the project name is the same as the dll name

AND

the sub MyClassSub takes no arguments ...



(vlax-invoke (vlax-create-object "MyVbProgam.MyClass") 'MyClassSub)



[ Omitting formal instancing and cleanup (vlax-release-object) etc ]
Engineering Technologist • CAD Automation Practitioner
Automation ▸ Design ▸ Drafting ▸ Document Control ▸ Client
cadanalyst@gmail.comhttp://cadanalyst.slack.comhttp://linkedin.com/in/cadanalyst

tdaniel14

  • Guest
Re: load dll with lisp
« Reply #6 on: January 25, 2008, 03:55:09 PM »
Thanks for the help guys.
I have tried different things and cannot get this to work for me.  :realmad:
If anyone happens to run across anything, please let me know!
I'll be banging my head against the wall trying to get this to work.

MP

  • Seagull
  • Posts: 17750
  • Have thousands of dwgs to process? Contact me.
Re: load dll with lisp
« Reply #7 on: January 25, 2008, 03:56:49 PM »
Is the dll registered?

Do you have (vl-load-com) at the beginning of your code or in your start-up lisp library?
Engineering Technologist • CAD Automation Practitioner
Automation ▸ Design ▸ Drafting ▸ Document Control ▸ Client
cadanalyst@gmail.comhttp://cadanalyst.slack.comhttp://linkedin.com/in/cadanalyst

tdaniel14

  • Guest
Re: load dll with lisp
« Reply #8 on: January 25, 2008, 04:17:53 PM »
dll is registered and I have (vl-load-com) at the beginning of my code

MP

  • Seagull
  • Posts: 17750
  • Have thousands of dwgs to process? Contact me.
Re: load dll with lisp
« Reply #9 on: January 25, 2008, 04:21:33 PM »
Time to ante up your code.
Engineering Technologist • CAD Automation Practitioner
Automation ▸ Design ▸ Drafting ▸ Document Control ▸ Client
cadanalyst@gmail.comhttp://cadanalyst.slack.comhttp://linkedin.com/in/cadanalyst

tdaniel14

  • Guest
Re: load dll with lisp
« Reply #10 on: January 25, 2008, 04:34:52 PM »
(defun c:rrrrr (/ acadapp vbapp)
(vl-load-com)
(setq acadapp (vlax-get-acad-object))     
(setq vbapp (vla-GetInterfaceObject acadapp "MyVbProgram.MyClass")) 
(vlax-invoke vbapp 'MyClassSub)
)


vb6 Activex dll is the type of dll i'm using.

MP

  • Seagull
  • Posts: 17750
  • Have thousands of dwgs to process? Contact me.
Re: load dll with lisp
« Reply #11 on: January 25, 2008, 05:06:00 PM »
You're sure the dll is registered AND the project name is "MyVbProgram" AND the (public) class name is "MyClass" AND the (public) sub is named "MyClassSub"?

Assuming "MyVbProgram.MyClass" is accurate what does AutoCAD return on --

Code: [Select]
(setq myObject
    (vla-GetInterfaceObject
        (vlax-get-acad-object)
        "MyVbProgram.MyClass"
    )
)

or

Code: [Select]
(setq myObject
    (vlax-create-object
        "MyVbProgram.MyClass"
    )
)

?
« Last Edit: January 25, 2008, 05:10:26 PM by MP »
Engineering Technologist • CAD Automation Practitioner
Automation ▸ Design ▸ Drafting ▸ Document Control ▸ Client
cadanalyst@gmail.comhttp://cadanalyst.slack.comhttp://linkedin.com/in/cadanalyst