Rob's suggestion of using the export should do what you want:
PolyML.export("noprint-poly", ?(fn () => (PolyML.print_depth 0; ? ? ? ? ? ?PolyML.Compiler.prompt1 := ""; ? ? ? ? ? ?PolyML.Compiler.prompt2 := ""; ? ? ? ? ? ?PolyML.rootFunction ())) );
Then you can run to make the new ml binary: ?cc -o empty-top-level-poly noprint-poly.o -lpolymain -lpolyml
Sorry, I can not reproduce this on my computer, the compiling yields:
,------------------------------------------------------------- [hf@mail ~]$ cc -o empty-top-level-poly noprint-poly.o -lpolymain -lpolyml /usr/bin/ld: cannot find -lpolymain `-------------------------------------------------------------
Regards, Hong
If you've installed polyml in a non-standard location, e.g. I have it in /Users/ldixon/local/polyml-5.4, then you need to also setup the library path appropriately, e.g.
export POLYML_PATH="/Users/ldixon/local/polyml-5.4" export POLYML_LIB="${POLYML_PATH}/lib" export LD_RUN_PATH="${POLYML_LIB}:${LD_RUN_PATH}" cc -o empty-top-level-poly noprint-poly.o -L${POLYML_LIB} -lpolymain -lpolyml
best, lucas
On 06/10/2011 21:42, Hong Feng wrote:
Rob's suggestion of using the export should do what you want:
PolyML.export("noprint-poly", (fn () => (PolyML.print_depth 0; PolyML.Compiler.prompt1 := ""; PolyML.Compiler.prompt2 := ""; PolyML.rootFunction ())) );
Then you can run to make the new ml binary: cc -o empty-top-level-poly noprint-poly.o -lpolymain -lpolyml
Sorry, I can not reproduce this on my computer, the compiling yields:
,------------------------------------------------------------- [hf@mail ~]$ cc -o empty-top-level-poly noprint-poly.o -lpolymain -lpolyml /usr/bin/ld: cannot find -lpolymain `-------------------------------------------------------------
Regards, Hong
On Fri, Oct 7, 2011 at 11:25 AM, Lucas Dixon ldixon@inf.ed.ac.uk wrote:
If you've installed polyml in a non-standard location, e.g. I have it in /Users/ldixon/local/polyml-5.4, then you need to also setup the library path appropriately, e.g.
export POLYML_PATH="/Users/ldixon/local/polyml-5.4" export POLYML_LIB="${POLYML_PATH}/lib" export LD_RUN_PATH="${POLYML_LIB}:${LD_RUN_PATH}" cc -o empty-top-level-poly noprint-poly.o -L${POLYML_LIB} -lpolymain -lpolyml
Thank you!
I finally got my first CGI program in SML works successfully! Here it is what I did:
,---------------------------------------------------------- (* a file named Hello placed under the cgi-bin directory of the apache web server *)
print("Content-Type: text/plain"); print("\n\n");
print("Hello, Poly/ML!"); `---------------------------------------------------------
Then created a program in sml named hello.sml with just the following two lines (note that give it with the execute rights under Unix):
,--------------------------------------------------------- #! /bin/sh ":"; exec /home/hf/empty-top-level-poly -q < Hello `---------------------------------------------------------
After done it, started the web browser to load it to run:
http://www.supernovas.cn/cgi-bin/hello.sml
Best, Hong