Hello,
David wrote in last message:
There hasn't been any discussion of this on the Poly/ML mailing list because, so far, there hasn't been ANY discussion on the mailing list.
Let us start one then:
I'm writing applications in Poly/ML that I intend to distribute in binary form. Currently, this requires users to download at least the polyml driver from polyml.org and install it. Not a big deal, but certainly an avoidable burden, specially when applications require several similar prerequisites.
I think a nice addition to the polyml tools would be one that packs the polyml driver with a database, in a single executable.
The tclpro compiler suite, for instance, has a convenient tool for such purposes, that wraps an interpreter with its libraries, code, and possibly data files, into a single executable. A similar "polywrap" tool would be perfect for my purposes.
Any plans for such a tool, or on-the-shelf alternatives ? Other opinions ?
Bernard.
--
Bernard Berthomieu ^ Bernard.Berthomieu@laas.fr LAAS / CNRS . /_\ http://www.laas.fr/~bernard 7, avenue du Colonel Roche / / \ phone +33/(0)5 61 33 63 63 31077 Toulouse Cedex / \ \ fax +33/(0)5 61 33 64 11 France / \ \ ____________________________________/ _______________________________
Hi Bernard, This is something I've been thinking about for a while and several people have asked about. I've had a look at this and managed to get something working. So far I've only tested it on Windows using Visual C++ and haven't tried it on Unix.
In order to create a single executable from a Poly/ML program there needs to be some way to create an object file from the Poly/ML database and then link this with the run-time system. The best way to do it would be to create an object file directly from the database but that requires knowing the format of an object file which probably differs between operating systems and architectures. The solution I adopted was to write out a massive C file containing the database as two vectors: one containing the immutable data and one containing the mutable data. It's then possible to compile this with a C compiler and link it with the run-time system.
The whole thing is a bit messy and really needs tidying up. For example, most of the time it's possible to get the system loader to handle relocation by having entries in the vectors which contain the addresses of other entries. It doesn't work for addresses which are embedded in machine code since they may well not be aligned on 4-byte boundaries. That means there has to be a vector containing extra relocation information for addresses in machine code. This wouldn't be needed if object code was generated directly because it could be included as part of the general relocation information.
Another problem was in making the database small enough before creating the C file. It's actually quite difficult to get rid of any reference to the compiler and all the compiler data structures so that using the database garbage collector reduces the database to only the application itself.
I guess I could let you have a copy of what I've done to experiment with. Do you have any other ideas or suggestions? David.
On Monday, March 25, 2002, at 11:40 , Bernard Berthomieu wrote:
Hello, Let us start one then:
I'm writing applications in Poly/ML that I intend to distribute in binary form. Currently, this requires users to download at least the polyml driver from polyml.org and install it. Not a big deal, but certainly an avoidable burden, specially when applications require several similar prerequisites.
I think a nice addition to the polyml tools would be one that packs the polyml driver with a database, in a single executable.
The tclpro compiler suite, for instance, has a convenient tool for such purposes, that wraps an interpreter with its libraries, code, and possibly data files, into a single executable. A similar "polywrap" tool would be perfect for my purposes.
Any plans for such a tool, or on-the-shelf alternatives ? Other opinions ?
Bernard.