gcl-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Gcl-devel] Re: Axiom/GCL on Windows


From: Camm Maguire
Subject: [Gcl-devel] Re: Axiom/GCL on Windows
Date: 05 Dec 2006 13:35:38 -0500
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.2

Greetings!

Gabriel Dos Reis <address@hidden> writes:

> On Tue, 5 Dec 2006, Camm Maguire wrote:
> 
> | Greetings!
> |
> | Gabriel Dos Reis <address@hidden> writes:
> |
> | > Hi Camm,
> | >
> | >  I'm making slow progress in building build-improvements on windows
> | > using mingw/sys).  From the outset I should say that I'm not a Windows
> | > programmer.
> | >
> | > The blocking problem for me at this moment has to do with Windows DLL
> | > and GCL.  As youy know, we use currently this Make rule:
> | >
> | > $(OUT)/lisp$(EXEEXT): $(GCL)
> | >   echo '(compiler::link nil "${OUT}/lisp" ' \
> | >               ' (format nil "(progn (let ((*load-path* (cons ~S 
> *load-path*))'\
> | >                                         ' (si::*load-types* ~S))' \
> | >                                        ' (compiler::emit-fn t))' \
> | >                                   ' (when (fboundp (quote si::sgc-on))' \
> | >                                         ' (si::sgc-on t))' \
> | >                                   ' (setq compiler::*default-system-p* 
> t))"' \
> | >                       ' si::*system-directory* (quote (list ".lsp")))' \
> | >                ' "$(build_libdir)/cfuns-c.o' \
> | >                '  $(build_libdir)/sockio-c.o' \
> | >                '  $(build_libdir)/libspad.a")' \
> | >             | $(GCL)
> | >
> | > to save an image appropriate to bootstrap the system.
> | >
> | > This works fine on many Unix-variant systems.  I'm sure it can be
> | > improved.
> | >
> | > The object sockio-c.o contains codes that link AXIOMsys with the OS
> | > sockets.  On windows, sockets are available only through a DLL
> | > (WinSock) and many of the POSIX interface are defined in terms of that
> | > DLL.  So, in the end when we come to save the image, the linker is
> | > unhappy because it cannot satisfy the symbols that are provided by the
> | > Windows.
> | >
> |
> | I'm inferring that you have symbol conflicts between the dll and
> | sockio-c.o?
> 
> I'm sorry, I could not copy and paste because the windows machine
> isn't conveniently accessible.
> 
> The error I'm having is that the linker complains it can't find the
> symbols which are supposed to be in the winsock dll.  The error
> message includes
> 
>    undefined reference to address@hidden'
>    undefined reference to address@hidden'
>    undefined refenrece to address@hidden'
> 

OK, for this, just add -lwinsock after libspad.a on the compiler::link
command line.  In general, you can link any shared lib in this way.

>    [...]
> 
> |  There is a linker flag which we use in cvs head to handle
> | the static linking case, where such a conflict exists between gcl's
> | malloc and that in libc.a.  On the gcc command line, it is
> | -Wl,-zmuldefs.  I believe this resolves the symbols in first come
> | first serve manner in the order in which the files appear on the
> | linker command line, but you might want to double check this.  You can
> | add this flag to the gcc command line used within gcl by
> |
> | (setq compiler::*cc* (concatenate 'string compiler::*cc* " -Wl,-zmuldefs"))
> |
> | But beyond this, you will have to ifdef the code in sockio-c.c to work
> | with windows,
> 
> Yes, that is what I tried first but then it did not work out quite
> right because there are other places that seem to require objects from
> sockio-c.o.  Which is why I fall back to trying to get sockio-c.o
> work. :-(
> 
> | which is not strictly posix compatable, to my understanding.
> 
> That is also my understand.  Within the last 24 hours I got to know
> more about Windows sockets than I wanted to knwo ;-)
> 
> | I would recommend instead using gcl sockets, which are already ported,
> | at least as of my last checking.  Then you don't even need the extra
> | sockio-c.c.
> 
> Yes, that would be much better.  I was unware of the gcl sockets.
> 
> |  Examples of the interface can be found in an earlier
> | thread on a mini native webserver within axiom as a gui option using
> | an external browser.
> 
> I'll dig out the archive.
> 
> | I can provide explicit examples should this be  needed.
> 
> I wouldn't mind :-)
> 
> | The info pages should also be helpful here.  If this sounds
> | like something worth pursuing, and everyone is happy with the idea,
> | please let me know and I will provide more details.
> 
> Since GCl is already working on mingw/msys and the socket library is
> already ported, I'm very happy to explore what you're suggesting.
> I'm saying this because I don't trust the current Axiom's sockio-c.c
> to work properly on POSIX-conformant systems -- let alone windows.
> I spent about a day on it, but I'm very happy to throw away the work
> if you can give me something better :-)

OK, here is a brief idea:

=============================================================================
>(let ((ss (si::socket 80 :host "www.yahoo.com"))) 
   (format ss "GET http://www.yahoo.com/ HTTP/1.0~a~a~a~a" #\Return #\Linefeed 
#\Return #\Linefeed)
   (do nil ((let ((q (read-line ss nil 'eof))) (print q) (= 0 (length q))))) 
(si::close ss))

" 
" 
" 
" 
" 
" 
" 
" 
"<html><head>" 
"<title>Yahoo!</title>" 
"<meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\">" 
"<meta http-equiv=\"PICS-Label\" content='(PICS-1.1 
\"http://www.icra.org/ratingsv02.html\"; l r (cz 1 lz 1 nz 1 oz 1 vz 1) gen true 
for \"http://www.yahoo.com\"; r (cz 1 lz 1 nz 1 oz 1 vz 1) 
\"http://www.rsac.org/ratingsv01.html\"; l r (n 0 s 0 v 0 l 0) gen true for 
\"http://www.yahoo.com\"; r (n 0 s 0 v 0 l 0))'>" 
"<base 
href=\"http://www.yahoo.com/_ylh=X3oDMTFkMm4yaDg1BF9TAzI3MTYxNDkEcGlkAzExNjUzNDMxMDAEdGVzdAMwBHRtcGwDaW5kZXgtdA--/\";
 target=\"_top\">" 
"<style type=\"text/css\">" 
"a{color:#16387c;}" 
"a:link,a:visited{text-decoration:none;}" 
"a:hover{text-decoration:underline;}" 
"</style>" 
"<style type=\"text/css\" media=\"all\">" 
"#p{width:310px;}" 
"form{margin:0;}" 
"</style>" 
"</head>" 
"<body link=\"#16387c\" vlink=\"#16387c\">" 
"<center>" 
"<table cellpadding=\"0\" cellspacing=\"0\" border=\"0\" bgcolor=\"#EEF3F6\" 
width=\"760\">" 
"<tr><td colspan=\"3\">" 
"<table cellpadding=\"0\" cellspacing=\"0\" border=\"0\" width=\"0\"><tr><td 
width=\"0\" height=\"7\"><spacer type=\"block\" width=\"0\" 
height=\"7\"></td></tr></table>" 
"</td></tr>" 
"<tr>" 
"<td width=\"10\" height=\"0\" rowspan=\"2\"><spacer type=\"block\" 
width=\"10\" height=\"0\"></td>" 
"<td height=\"56\" valign=\"top\">" 
"<img src=\"http://us.a1.yimg.com/us.yimg.com/i/ww/beta/y3.gif\"; width=\"232\" 
height=\"44\" alt=\"Yahoo!\" title=\"Yahoo\">" 
"</td>" 
"<td rowspan=\"2\">" 
"<table cellpadding=\"1\" cellspacing=\"0\" border=\"0\" bgcolor=\"#BFCFD7\">" 
"<tr><td>" 
"<table cellpadding=\"20\" cellspacing=\"0\" border=\"0\" bgcolor=\"#F4F6F5\">" 
"<tr><td><font face=\"arial\" size=\"-1\">" 
"<form name=\"sf1\" action=\"http://www.yahoo.com/r/zz\";>" 
"<input type=\"hidden\" name=\"u\" 
value=\"http://search.yahoo.com/search?fr=FP-pull-web-t&ei=UTF-8&p=\"; />" 
"<table cellpadding=\"0\" cellspacing=\"0\" border=\"0\">" 
"<tr>" 
"<td><font size=\"+0\"><input type=\"text\" name=\"p\" id=\"p\" size=\"20\" 
/></font></td>" 
"<td><input type=\"image\" value=\"Web Search\" 
src=\"http://us.i1.yimg.com/us.yimg.com/i/ww/tbl/webs.gif\"; alt=\"Web Search\" 
border=\"0\" /></td>" 
"</tr></table>" 
"</form><span style=\"margin-top:-1em\"></span>" 
"</font></td></tr></table>" 
"</td></tr></table>" 
"</td>" 
"</tr>" 
"<tr>" 
"<td>" 
"<table cellpadding=\"0\" cellspacing=\"0\" border=\"0\">" 
"<tr>" 
"<td width=\"10\" height=\"0\"><spacer type=\"block\" width=\"10\" 
height=\"0\"></td>" 
"<td>" 
"<table cellpadding=\"0\" cellspacing=\"0\" border=\"0\">" 
"<tr>" 
"<td width=\"100%\" height=\"1\" bgcolor=\"#dee6e9\" colspan=\"5\"><spacer 
type=\"block\" width=\"100%\" height=\"1\"></td>" 
"</tr><tr>" 
"<td width=\"1\" height=\"100%\" bgcolor=\"#dee6e9\" nowrap><spacer 
type=\"block\" width=\"1\" height=\"100%\"></td>" 
"<td width=\"5\" height=\"1\" bgcolor=\"#dde8ea\" 
background=\"http://us.i1.yimg.com/us.yimg.com/i/ww/tbl/fdbg.gif\";><spacer 
type=\"block\" width=\"5\" height=\"1\"></td>" 
"<td><table cellpadding=\"2\" cellspacing=\"0\" border=\"0\" 
bgcolor=\"#DEE6E9\">" 
"<tr><td bgcolor=\"#dde8ea\" 
background=\"http://us.i1.yimg.com/us.yimg.com/i/ww/tbl/fdbg.gif\"; 
nowrap=\"nowrap\"><font face=\"arial\" size=\"-1\"><a href=\"r/i1\">My 
Yahoo!</a></font></td></tr></table></td>" 
"<td width=\"5\" height=\"1\" bgcolor=\"#dde8ea\" 
background=\"http://us.i1.yimg.com/us.yimg.com/i/ww/tbl/fdbg.gif\";><spacer 
type=\"block\" width=\"5\" height=\"1\"></td>" 
"<td width=\"1\" height=\"100%\" bgcolor=\"#586B7A\" nowrap><spacer 
type=\"block\" width=\"1\" height=\"100%\"></td>" 
"</tr><tr>" 
"<td width=\"100%\" height=\"1\" bgcolor=\"#586B7A\" colspan=\"5\" 
nowrap><spacer type=\"block\" width=\"100%\" height=\"1\"></td>" 
"</tr></table>" 
"</td>" 
"<td width=\"10\" height=\"0\"><spacer type=\"block\" width=\"10\" 
height=\"0\"></td>" 
"<td>" 
"<table cellpadding=\"0\" cellspacing=\"0\" border=\"0\">" 
"<tr>" 
"<td width=\"100%\" height=\"1\" bgcolor=\"#dee6e9\" colspan=\"5\"><spacer 
type=\"block\" width=\"100%\" height=\"1\"></td>" 
"</tr><tr>" 
"<td width=\"1\" height=\"100%\" bgcolor=\"#dee6e9\" nowrap><spacer 
type=\"block\" width=\"1\" height=\"100%\"></td>" 
"<td width=\"5\" height=\"1\" bgcolor=\"#dde8ea\" 
background=\"http://us.i1.yimg.com/us.yimg.com/i/ww/tbl/fdbg.gif\";><spacer 
type=\"block\" width=\"5\" height=\"1\"></td>" 
"<td><table cellpadding=\"2\" cellspacing=\"0\" border=\"0\" 
bgcolor=\"#DEE6E9\">" 
"<tr><td bgcolor=\"#dde8ea\" 
background=\"http://us.i1.yimg.com/us.yimg.com/i/ww/tbl/fdbg.gif\"; 
nowrap=\"nowrap\"><font face=\"arial\" size=\"-1\"><a href=\"r/m1\">My 
Mail</a></font></td></tr></table></td>" 
"<td width=\"5\" height=\"1\" bgcolor=\"#dde8ea\" 
background=\"http://us.i1.yimg.com/us.yimg.com/i/ww/tbl/fdbg.gif\";><spacer 
type=\"block\" width=\"5\" height=\"1\"></td>" 
"<td width=\"1\" height=\"100%\" bgcolor=\"#586B7A\" nowrap><spacer 
type=\"block\" width=\"1\" height=\"100%\"></td>" 
"</tr><tr>" 
"<td width=\"100%\" height=\"1\" bgcolor=\"#586B7A\" colspan=\"5\" 
nowrap><spacer type=\"block\" width=\"100%\" height=\"1\"></td>" 
"</tr></table>" 
"</td>" 
"</tr></table>" 
"</td>" 
"</tr>" 
"<tr><td colspan=\"3\">" 
"<table cellpadding=\"0\" cellspacing=\"0\" border=\"0\" width=\"0\"><tr><td 
width=\"0\" height=\"9\"><spacer type=\"block\" width=\"0\" 
height=\"9\"></td></tr></table>" 
"</td></tr>" 
"</table>" 
"<table cellpadding=\"0\" cellspacing=\"0\" border=\"0\" width=\"0\"><tr><td 
width=\"0\" height=\"5\"><spacer type=\"block\" width=\"0\" 
height=\"5\"></td></tr></table>" 
"" 
T

>
=============================================================================
 -- Function: SOCKET (port &key host server async myaddr myport daemon)
     Establishes a socket connection to the specified PORT under a
     variety of circumstances.

     If HOST is specified, then it is a string designating the IP
     address of the server to which we are the client.  ASYNC specifies
     that the connection should be made asynchronously, and the call
     return immediately.  MYADDR and MYPORT can specify the IP address
     and port respectively of a client connection, for example when the
     running machine has several network interfaces.

     If SERVER is specified, then it is a function which will handle
     incoming connections to this PORT.  DAEMON specifies that the
     running process should be forked to handle incoming connections in
     the background.  If DAEMON is set to the keyword PERSISTENT, then
     the backgrounded process will survive when the parent process
     exits, and the SOCKET call returns NIL.  Any other non-NIL setting
     of DAEMON causes the socket call to return the process id of the
     backgrounded process.  DAEMON currently only works on BSD and
     Linux based systems.

     If DAEMON is not set or nil, or if the socket is not a SERVER
     socket, then the SOCKET call returns a two way stream.  In this
     case, the running process is responsible for all I/O operations on
     the stream.  Specifically, if a SERVER socket is created as a
     non-DAEMON, then the running process must LISTEN for connections,
     ACCEPT them when present, and call the SERVER function on the
     stream returned by ACCEPT.


 -- Function: ACCEPT (stream)
     Creates a new two-way stream to handle an individual incoming
     connection to STREAM, which must have been created with the SOCKET
     function with the SERVER keyword set.  ACCEPT should only be
     invoked when LISTEN on STREAM returns T.  If the STREAM was
     created with the DAEMON keyword set in the call to SOCKET, ACCEPT
     is unnecessary and will be called automatically as needed.
=============================================================================

Does AXIOMsys push requests to an sman server, or the other way
around?  If the latter, you can setup a server socket, with a server
function handling the reading and writing passed to the socket call
with the :server keyword.  Optionally, said server can be forked into
the background (but not on windows, but perhaps eventually on
cygwin.).

Take care,

> 
> Thanks!
> 
> -- Gaby
> 
> 
> 

-- 
Camm Maguire                                            address@hidden
==========================================================================
"The earth is but one country, and mankind its citizens."  --  Baha'u'llah




reply via email to

[Prev in Thread] Current Thread [Next in Thread]