Visual LISP, AutoLISP and General Customization
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Lisp won't run after compiling it into a VLX

11 REPLIES 11
Reply
Message 1 of 12
wcruz
266 Views, 11 Replies

Lisp won't run after compiling it into a VLX

I have made a simple lsp that makes a call to a DLL and it works fine in lsp format but when I compile it and make a VLX file it doesn't work.

What's me doing wrong?

William
11 REPLIES 11
Message 2 of 12
Anonymous
in reply to: wcruz

Post here your code.

wrote in message news:5495235@discussion.autodesk.com...
I have made a simple lsp that makes a call to a DLL and it works fine in lsp
format but when I compile it and make a VLX file it doesn't work.

What's me doing wrong?

William
Message 3 of 12
wcruz
in reply to: wcruz

Here is the lisp code:

(defun c:ShowDialog (/ acadApp vbApp)

(vl-load-com)

;; get the main AutoCAD application object
(setq acadApp
(vlax-get-acad-object)
)

;; load VB ActiveX DLL into AutoCAD's address space
(setq vbApp
(vla-GetInterfaceObject acadApp "Expcg.Dialog1")
)

(if (not vbApp)
(princ "\nError loading Expcg.dll.")
(progn
(princ "\nExpcg.dll loaded.")
; continue here like the DOC says
;(vlax-invoke vbApp "your_vba_function_name" with arguments

(vlax-invoke vbApp "show")
)
)
(princ)
)
Message 4 of 12
Anonymous
in reply to: wcruz

im just learning the vlx deal myself and this is just takign a stab but perhaps put the vl-load-com before the (defun ) call
you have this
(defun c:ShowDialog (/ acadApp vbApp)

(vl-load-com)

instead make it

(vl-load-com)
(defun c:ShowDialog (/ acadApp vbApp)
Message 5 of 12
wcruz
in reply to: wcruz

Still not working. Thanks anyway.

William
Message 6 of 12
Anonymous
in reply to: wcruz

wcruz wrote:
> Still not working. Thanks anyway.
>
> William

Do you have it compiled to run in a separate namespace?
Message 7 of 12
wcruz
in reply to: wcruz

After receiving your response, I tried with & without separate namespace with & without activex support and it still doesn't work.
Message 8 of 12
Anonymous
in reply to: wcruz

wcruz wrote:
> After receiving your response, I tried with & without separate namespace with & without activex support and it still doesn't work.

OK. Explain a little more what "doesn't work" means. Is Autocad
crashing with an access violation? Is the Autocad command line saying
"command not found" or "undefined function"? Is Windows crashing with a
blue screen? If we know what IS happening, maybe we can narrow it down
a bit. Otherwise it's just guesswork.

Regards,

-Rick Francken
www.franckensoft.com
Message 9 of 12
wcruz
in reply to: wcruz

"Unknown Command"
Message 10 of 12
Anonymous
in reply to: wcruz

wcruz wrote:
> "Unknown Command"

If you are calling your function in LISP, (command "ShowDialog") will
cause that message. Use (C:ShowDialog) instead.

If that's not how you are calling your function, show us how you are
using it.

Regards,

-Rick Francken
www.franckensoft.com
Message 11 of 12
wcruz
in reply to: wcruz

The entire lisp program is @ the beginning of this thread. In the CAD command prompt I tried using (c:showdialog) & c:showdialog but still get the "Unknown Command"
Message 12 of 12
Anonymous
in reply to: wcruz

wcruz wrote:
> The entire lisp program is @ the beginning of this thread. In the CAD command prompt I tried using (c:showdialog) & c:showdialog but still get the "Unknown Command"

Well, I copied that code, substituting an (alert "success") call for the
DLL "Show" call because I don't have the DLL. Then I saved it to a .lsp
file, created a VLX application with "New Application Wizard", compiled
it to VLX using "Make Application", then loaded it in AutoCAD (2007).

I then entered the following combinations at the command prompt:

Showdialog - alert dialog "success" displayed
(C:ShowDialog) - alert dialog "success" displayed
C:ShowDialog - Unknown command "C:SHOWDIALOG". Press F1 for help.
(ShowDialog) - ; error: no function definition: SHOWDIALOG
ShowDialoq - Unknown command "SHOWDIALOQ". Press F1 for help.

So it seems to be working as it should here.

Regards,

Rick Francken
www.franckensoft.com

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report

”Boost