Edit
Attach
Printable
topic end
<!-- * Set TOPICTITLE = <nop>CoCreate Modeling FAQ: Lisp compiler --> ---++!! CoCreate Modeling FAQ: Lisp compiler %TOC% <style type="text/css"> pre { background-color:#FFEECC; } </style> --- <a name="compilelisp"></a> ---+++ %ENGLISH% How do I compile Lisp code? To compile Lisp code, use the =compile-file= command: <pre> (compile-file "somepath/yourlispfile.lsp") </pre> Make sure to open the console window before compilation (=View/Console=) because you will find diagnostic information there. The resulting DLL will be generated in the current directory. In order to use =compile-file=, you must install the Integration Kit beforehand. This is a separate option in the installation program; use custom installation mode to select this option. You will also need an Integration Kit license for the compiler. Under the hood, the Lisp compiler uses Microsoft's Visual C++ to create the object code. Therefore, you must make sure to install the right version of Visual C++ on your system before running the Lisp compiler. The Integration Kit documentation will tell you which version is required - see <a href="#compilerversion">below</a>. Under HP-UX, HP's =aCC= compiler is required. ---++++ %GERMAN% Wie übersetze ich Lisp-Code? Um Lisp-Code zu übersetzen, benutzt man das Kommando =compile-file=: <pre> (compile-file "irgendeinpfad/lispdatei.lsp") </pre> Vorher sollte man das Konsolenfenster geöffnet haben (=Ansicht/Konsole=), weil dort wichtige Diagnosemeldungen ausgegeben werden. Die erzeugte DLL findet man dann im aktuellen Verzeichnis. Um =compile-file= benutzen zu können, muß man vorher das Integration Kit installieren. Das ist eine eigene Option im Installationsprogramm von <nop>CoCreate Modeling; man wähle eine benutzerangepaßte Installation und dann darin die Option für das Integration Kit. Außerdem braucht man für den Compiler auch eine Integration-Kit-Lizenz. Intern verwendet der Lisp-Compiler Microsoft Visual C++, um den Objektcode zu erzeugen. Daher muß man die passende Version von Visual C++ installieren, bevor man den Lisp-Compiler benutzen kann. Die Dokumentation zum Integration Kit gibt die jeweils benötigte Version des C++-Compilers an - siehe <a href="#compilerversion">weiter unten</a>. Unter HP-UX wird der Compiler =aCC= von HP verwendet. -- Main.ClausBrod - 23 Dec 2004 --- <a name="compilerversion"></a> ---+++ %ENGLISH% Which version of Visual C++ is required to compile Lisp code for my version of <nop>CoCreate Modeling? Visual C++ version recommendations can be found in the Integration Kit online help documentation (Documentation for advanced users" / "Integration Kit" / "Introduction"). The following table lists recommendations for a few versions of <nop>CoCreate Modeling: | *CoCreate Modeling* | *Visual C++* | | 2004 | Visual C++ 6.0 | | 2005 | <nop>VS.NET 2003 | | 2006/v14.0x for 32-bit systems | <nop>VS.NET 2003 | | 2006/v14.0x for 64-bit systems | Visual Studio 2005 | | 2006/v14.50 for 32-bit and 64-bit systems | Visual Studio 2005 | | 2008 | Visual Studio 2005??? | | 17 | Visual C++ 2008 SP1 | | 18.1 | Visual C++ 2010 | ---++++ %GERMAN% Welche Version von Visual C++ brauche ich, um Lisp-Code für meine Version von <nop>CoCreate Modeling zu übersetzen? Empfehlungen für die passende Version von Visual C++ findet man in der Hilfe zum Integration Kit (Documentation for advanced users" / "Integration Kit" / "Introduction"). Die <a href="#compilerversion">obige Tabelle</a> führt Empfehlungen für einige Versionen von <nop>CoCreate Modeling auf. -- Main.ClausBrod - 22 Jun 2018 --- ---+++ %ENGLISH% How do I load a compiled Lisp file? The same way as an uncompiled file, i.e. using the =load= command: <pre> (load "somepath/compiledlispfile") </pre> If a file called =compiledlispfile.dll= (HP-UX: =compiledlispfile.so=) is in the specified path, this will load it. ---++++ %GERMAN% Wie lade ich ein übersetztes Lisp-File? Genauso wie ein noch nicht übersetztes, nämlich mit dem Kommando =load=: <pre> (load "irgendeinpfad/compiledlispfile") </pre> Wenn es eine Datei namens =compiledlispfile.dll= (HP-UX: =compiledlispfile.so=) im angegebenen Pfad gibt, wird sie hiermit geladen. -- Main.ClausBrod - 23 Dec 2004 --- #CompileFile ---+++ %ENGLISH% Compiling a Lisp file using =compile-file= fails, and I get a strange Lisp error message If the Lisp error is "The function COMPILE-FILE is undefined.", then you need to install the Integration Kit first. Start the installation program and add this component to your installation. (You'll need to use "custom" installation mode.) There is also another class of potential Lisp errors which look like this: <pre> LISP error: (SYSTEM ("SDLCPAS3" "-" "c:\\temp" -o" ...)) returned a non-zero value 3. </pre> If you see this ultra-cryptic error message, it means that compilation of the Lisp code has failed. As a first step to find out what is happening, open the console window (=View/Console=), then try to compile the Lisp file again. You will sometimes get more informative error output in the console window. The most frequent problems are: * <p>To compile Lisp code into a DLL, a C++ compiler is required. <nop>CoCreate Modeling assumes that a copy of Visual C++ is installed on the system, and that the compiler and linker can be executed by calling the executables =cl.exe= and =link.exe=, respectively. <nop>CoCreate Modeling runs those programs via the system command shell; in order to find the programs, the command shell searches all directories which are specified in the =PATH= environment variable. If =cl.exe= and =link.exe= cannot be found in any of the directories in =PATH=, compilation will fail. </p><p> Sometimes, Visual C++ does not add the required directories to =PATH= during installation, or does so only for the user who installs the software, but not for any other users of the system. </p><p> Even worse, not only the =PATH= environment variable, but also the =LIB= and =INCLUDE= environment variables must be set correctly during Visual C++ installation. </p><p> The easiest fix for this is to reinstall Visual C++ on the system, and making sure that it adds itself to the environment variables for the user(s) who later want to compile Lisp code. </p> * <p>Lisp compilation will only work reliably with the version of Visual C++ which is specified in the Integration Kit documentation. The table <a href="#compilerversion">above</a> lists <nop>CoCreate Modeling versions and corresponding versions of Visual C++.</p> The error code in the message above ("...retured a non-zero value <i>n</i>") actually contains useful information about the type of compilation issue: <div align="center"> | *Error code* | *What it means* | *What you can do about it* | | 1 | Script called with wrong arguments. | Check parameters to the =compile-file= command | | 2 | Clsp file not found (error in compiler front-end) | | | 3 | C++ compilation error | Check settings for environment variables, see below | | 4 | Linker error | Check correct compiler/linker installation | | 5 | C++ compiler version on the system is not supported. | Check correct compiler/linker installation | </div> Here's a simple method to test the compiler installation: Open a DOS shell window, then enter "cl". If you get an error message such as "cl is not recognized as an internal or external command", either there is no compiler installation on the system, or the =PATH= environment variable does not include references to the compiler installation directories. If the compiler is found, it will report its version and display usage information: <pre> Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 13.10.3077 for 80x86 Copyright (C) Microsoft Corporation 1984-2002. All rights reserved. usage: cl [ option... ] filename... [ /link linkoption... ] </pre> The above is the expected output for <nop>VS.NET 2003, which is required to compile Lisp files for <nop>CoCreate Modeling 2005. Now check if the environment variables =PATH=, =INCLUDE= and =LIB= are set correctly. Open a DOS shell window and check those environment variables. The following captures a DOS shell session on my system (where <nop>VS.NET 2003 is installed): <pre> c:\temp>echo %INCLUDE% C:\Program Files\Microsoft Visual Studio .NET 2003\SDK\v1.1\include\; C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\Include; C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\ATLMFC\Include; C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Include c:\temp>echo %LIB% C:\Program Files\Microsoft Visual Studio .NET 2003\SDK\v1.1\Lib\; C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\Lib; C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\ATLMFC\Lib; C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Lib c:\temp>path PATH=....<i>someotherdirectories</i>... c:\Program Files\Microsoft Visual Studio .NET 2003\Common7\IDE; c:\Program Files\Microsoft Visual Studio .NET 2003\Common7\Tools; c:\Program Files\Microsoft Visual Studio .NET 2003\Common7\Tools\Bin; c:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\Bin; c:\Program Files\Microsoft Visual Studio .NET 2003\SDK\v1.1\Bin; </pre> -- Main.ClausBrod, last updated 2006/11/27 --- #InitializerFunctionNotFound ---+++ %ENGLISH% When loading a compiled Lisp file, I get an "Initializer function not found" message. * Is the compilation environment set up correctly? For example, you must make sure that you are using a C++ compiler which matches the version of <nop>CoCreate Modeling you are using (see [[#CompileFile][above]] for details). * Maybe the Lisp file was compiled in a different version of <nop>CoCreate Modeling. While interpreted Lisp code is largely compatible across versions, the same is not necessarily true for compiled code. * Never rename a compiled Lisp file. If you need to rename the DLL, rename the =*.lsp= file first, then re-compile. * Double-check the character cases in your filename e.g. Foobar.lsp can compile into foobar.dll especially when using a samba like server. * Do not use backslashes in path specifications for the =compile-file= command: <pre> (compile-file "c:/temp/foobar.lsp") ;; OK (cd "c:/temp")(compile-file "foobar.lsp") ;; OK (compile-file "c:\\temp\\foobar.lsp") ;; won't work </pre> ---++++ %GERMAN% Beim Laden einer übersetzten Lisp-Datei bekomme ich eine Fehlermeldung "Initializer function not found" * Ist die Compilerumgebung richtig eingerichtet? Beispielsweise ist es wichtig, daß der verwendete C++-Compiler zur Version von <nop>CoCreate Modeling paßt (siehe [[#CompileFile][oben]]). * Möglicherweise ist die Lisp-Datei in einer anderen Version von <nop>CoCreate Modeling übersetzt worden. Interpretierter Lisp-Code ist zwar über Versionen hinweg ausführbar, übersetzter Code aber nicht unbedingt. * Übersetzte Lisp-Dateien darf man _nicht_ umbenennen! Wenn ein neuer Name doch einmal sein muß, so benennt man zuerst die <tt>*.lsp</tt>-Datei um und übersetzt dann noch einmal neu. * Vorsicht vor Fehlern bei der Groß/Kleinschreibung. Wenn man beispielsweise auf einem Samba-Laufwerk eine Datei =Foobar.lsp= übersetzt, kann daraus je nach Samba-Konfiguration =foobar.dll= werden. * In Pfadangaben für das Kommando =compile-file= darf man kein Backslash-Zeichen verwenden: <pre> (compile-file "c:/temp/foobar.lsp") ;; OK (cd "c:/temp")(compile-file "foobar.lsp") ;; OK (compile-file "c:\\temp\\foobar.lsp") ;; führt zu Ladefehler </pre> -- Main.ClausBrod (with contribution from Main.JohnVanDoorn) - 11 February 2005 %COMMENT{type="below" nonotify="on"}%
to top
End of topic
Skip to action links
|
Back to top
Edit
|
Attach image or document
|
Printable version
|
Raw text
|
Refresh
|
More topic actions
Revisions: | r1.7 |
>
|
r1.6
|
>
|
r1.5
|
Total page history
|
Backlinks
You are here:
CoCreateModeling
>
OsdmFaqLispCompiler
r1.7 - 22 Jun 2018 - 19:26 -
ClausBrod
to top
CoCreateModeling
CoCreate Modeling
FAQ
Introduction
Hardware
Operating system
Memory management
File handling
Installation
Licensing
Graphics
App. knowhow
Lisp
Learning
Programming
Debugging
DDE
Compiler
Customization
Troubleshooting
Links
Code examples
Viewbench
News
Changes
Index
Search
Impressum
Home
Webs
Atari
Blog
Claus
CoCreateModeling
Klassentreffen
Main
Sandbox
Sommelier
TWiki
Xplm
My links
edit
TWiki
Welcome
TWiki Web TWiki Web Home Changes Topics Index Search
TWiki Webs Atari Blog Main
OneSpaceModeling
?
Sandbox TWiki TWiki Webs Atari Blog Main
OneSpaceModeling
?
Sandbox TWiki
Jump:
Copyright © 1999-2024 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki?
Send feedback