回望南山
记忆痕迹可以鲜明, 回望往事如数家珍——
posts - 177,  comments - 54,  trackbacks - 0

Visual Lisp provides you with the ability to create a single, standalone executable module for your application. This module incorporates all your application's compiled files, and can include DCL, DVB, and other files that your application may need. Executable Visual Lisp modules are known as VLX files, and are stored in files named with a .vlx extension.

A Make Application wizard guides you through the application building process in Visual Lisp. The result of this process is a Make file, which is often referred to by its file extension, .prv. The Make file contains all the instructions Visual Lisp needs to build the application executable.

To test this out, I've provided an AutoLISP Application that consists of an AutoLISP file, and a DCL file. From these 2 files we will compile one vlx executable module. (Just click here to download the source files). Unzip these files and save them in any directory within your AutoCAD Support Path. 

OK, fire up AutoCAD and open the Visual Lisp Editor. Now select "Files" - "Make Application" - "New Application" from the pulldown menu :

This dialog will appear :

Select "Expert" mode as we want to compile multiple file types, and then press "Next" :

Enter the path to the directory you would like to store the files in. Select the same directory that you stored the AutoLISP source files.
Then, give your application a name. It does not have to be the same as your AutoLISP source file, but to spare any confusion, let's keep it the same.
The select "Next" :

No, we do not want our application to run in a separate namespace.
Just select "Next" :

Now we need to select our AutoLISP source file. Select "refl.lsp" then press "Next" :

In this dialog, we select and add any dependency files that our application needs to run correctly. Select "refl.dcl" and then "Next" :

No need to confuse you now, just go with the "Standard" option. Select "Next" :

OK, that's us about done. To build your compiled application, just select "Finish".

VLisp of AutoCAD executes instructions in a Make file to build an application. Output messages from this process appear in two VLisp of AutoCAD windows: the Build Output window and the Console window. The Build Output window contains messages relating to any compilation of AutoLISP source code into .fas files. In a successful compile, the output looks like the following :

; (COMPILE-FILES st (D:/drawings/refl.lsp))
[Analyzing file "D:/drawings/refl.lsp"]
..
......
[COMPILING D:/drawings/refl.lsp]
;
;;C:REFL
;CCC
;;MKLIST
;;SPINBAR
;;INITERR
;;TRAP
;;RESET
;
[FASDUMPING object format -> "D:/drawings/refl.fas"]
; Compilation complete.

The compiler messages identify the following items:

  • The name and directory path of the source files being compiled.
  • The functions defined in the source file. Seven functions are identified: C:REFL, CCC, MKLIST, SPINBAR, INITERR, TRAP and RESET.
  • The name and path of the output .fas files.

The VLisp of AutoCAD Console window displays messages relating to the creation of the application executable, the .vlx file. If the Make Application process succeeds, the Console window displays the path and file name of the .vlx, as in the following example:

VLX-Application packed D:/drawings/refl.VLX
_$


Have a look in the directory where you stored the source files. You should now have 5 "refl" files :

  • refl.lsp - AutoLISP source file
  • refl.dcl - DCL source file
  • refl.fas - Compiled AutoLISP Program
  • refl.vlx - Executable Visual Lisp Module
  • refl.prv - Application Make file.

You can now distribute "refl.vlx" as a compiled application.

Note!!! You CANNOT edit a vlx file. These 5 files need to be kept in a safe location if you intend to edit or revise your vlx file.


Loading Compiled AutoLISP Applications :

Loading compiled applications is exactly the same as for normal AutoLISP functions :

(load "refl")

Here's a couple of things to keep in mind :

If you do not specify a file extension, load first looks for a file with the name you specified (for example, "refl"), and an extension of .vlx. If no .vlx file is found, load searches next for a .fas file, and finally, if no .fas file is found, load searches for a .lsp file.


Tip of the Day :

To aid you in the process of maintaining multiple-file applications, VLisp of AutoCAD provides a construct called a Project. A VLisp of AutoCAD Project contains a list of AutoLISP source files, and a set of rules on how to compile the files.
Using the Project definition, VLisp of AutoCAD can do the following :

  • Check which .lsp files in your application have changed, and automatically recompile only the modified files. This procedure is known as a Make procedure.
  • Simplify access to source files by listing all source files associated with a project, making them accessible with a single-click.
  • Help you find code fragments by searching for strings when you do not know which source files contain the text you're looking for. VLisp of AutoCAD limits the search to files included in your project.
  • Optimize compiled code by directly linking the corresponding parts of multiple source files.

Have a look at the Visual Lisp Help for further information on Projects.

posted on 2008-04-05 16:52 深藏记忆 阅读(617) 评论(3)  编辑  收藏 所属分类: 转载Vlisp

FeedBack:
# re: Compiling AutoLisp Files - Page II[未登录]
2010-12-14 02:10 | wan
haoyong  回复  更多评论
  
# re: Compiling AutoLisp Files - Page II[未登录]
2010-12-14 02:11 | wan
hao  回复  更多评论
  
# re: Compiling AutoLisp Files - Page II[未登录]
2010-12-14 02:11 | wan
hao  回复  更多评论
  

飘过是缘,相识最真

订阅到抓虾
google reader
gougou


点击这里给我发消息


<2008年4月>
303112345
6789101112
13141516171819
20212223242526
27282930123
45678910

常用链接

留言簿(5)

随笔分类

随笔档案

文章分类

文章档案

相册

收藏夹

八面来息

天天充电

同行者

积分与排名

  • 积分 - 59540
  • 排名 - 62

最新评论

阅读排行榜

评论排行榜