[Ecls-list] standalone executable under Windows with MSVC and socket support

Antonio Bonifati antonio.bonifati at gmail.com
Tue Jun 12 07:32:35 UTC 2012


On 11 June 2012 22:30, Juan Jose Garcia-Ripoll <
juanjose.garciaripoll at googlemail.com> wrote:

> sockets.fas is not linked in your program because you probably use
> (REQUIRE :sockets). Why not list it as a dependency on your ASDF file?
>

Molte grazie, many thanks. I had only usocket as a dependency in my ASDF
file. It is usocket that uses a (require 'sockets), not my code. In the
usocket code (file backend/sbcl.lisp) I have found this code:

;; There's no way to preload the sockets library other than by requiring it
;;
;; ECL sockets has been forked off sb-bsd-sockets and implements the
;; same interface. We use the same file for now.
#+ecl
(eval-when (:compile-toplevel :load-toplevel :execute)
  (require :sockets))

I do not know how to fix that, but I think it is better I get rid of
usocket and use ECL sockets directly. My application is not portable for
other reasons too.

ECL does not have support for building statically linked executables in
> Windows.... the Makefile has not been adapted.
>
...

>  how can I tell Lisp to load all dependency files from another directory
>> than the one the .exe file is found? (e.g. a subdir)
>>
> Change the system directory using
> setenv("ECLDIR","whatever/path/you/want") before calling cl_boot().
>

Unfortunately, I do not have a C program, I am compiling only Lisp code.
Anyway, I think I will distribute the three or two files (exe, ucd.dat,
ecl.dll) in the same directory. As a matter of fact, requiring users to
install the whole ECL distribution for Windows just to run my little
program is overkill. These three files are much smaller than the whole
thing.

BTW I had a hard time trying to figure out how to execute some code in the
CL-USER package to bootstrap my package. The only way that worked for me
was rather tricky:

in my project ASDF file:

:components (
  ...
  #+eclbuild (:file "prologue"))

in prologue.lisp:

(defpackage #:cl-user (:use #:cl #:my-pkg))
(in-package :cl-user)

(my-pkg-main)

Then I have to remember to do:

(pushnew :eclbuild *features*)

before issuing:

(asdf:make-build :hyde :type :program)

:prologue-code and :epilogue-code didn't work for me here.

Thanks, Antonio Bonifati
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.common-lisp.net/pipermail/ecl-devel/attachments/20120612/f5ed55e3/attachment.html>


More information about the ecl-devel mailing list