Re: on cygwin target, executable only starts if named lisp.exe

Vibhu Mohindra <[email protected]> Sat, 6 Apr 2024 02:58:23 +0200
Newsgroups gmane.lisp.clisp.devel
Message-ID <GVXP195MB18322E9E1319A723089A832DCA022@GVXP195MB1832.EURP195.PROD.OUTLOOK.COM>
The configure flag --without-dynamic-modules solves the executable image 
saving/loading problem.

----

Details:

src/lispbibl.d contains this code below, which I'm guessing causes an 
import table entitled "lisp.exe" and containing function names to be placed 
in base/lisp.exe. Such a title is apparently what causes a problem if the 
executable file is renamed to something else or saved as an executable 
image named other than "lisp.exe". Disabling dynamic modules prevents such 
a table from being produced and embedded, allowing (saveinitmem "test2" 
:executable t) to create a successfully startable file named other than 
"lisp.exe".

Extract from src/lispbibl.d:

/* this is necessary to avoid messages like
    Info: resolving _mv_space by linking to __imp__mv_space (auto-import)
    on woe32. */
#if defined(DYNAMIC_MODULES)
   #if defined(WIN32_NATIVE) || defined(UNIX_CYGWIN)
     #define DYNAMIC_TABLES 1
     #define modexp  __declspec(dllexport)
     #define modimp  __declspec(dllimport)
     #define EXECUTABLE_NAME "lisp.exe"
   #else
     #define DYNAMIC_TABLES 0
     #define modexp
     #define modimp  extern
   #endif
#else
   #define DYNAMIC_TABLES 0
   #define modexp
   #define modimp  extern
#endif

Cross-check: I notice that indeed (software-type):
1. in my earlier problematic cygwin target build shows the 
-DDYNAMIC_MODULES flag.
2. in the new build described above doesn't show that flag.
3. in the old mingw target build that didn't exhibit the problem, doesn't 
show that flag, so it must have been turned off automatically for mingw.

So it does look like my theory above is correct.

Also, the clisp packaged with cygwin does show -DDYNAMIC_MODULES in 
(software-type), which may be why its builder patched his build to disable 
saving executable images.

Vibhu


_______________________________________________
clisp-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/clisp-devel