I built a "Hello World" program as follows,
type h.scm
(display "Hello ")
type w.scm
(display "World")
gsc -link h w gsc -obj h.c w.c w_.c gcc -o w.exe h.o w.o w_.o C:/Gambit-C_64bit/v4.7.3/lib/libgambc.a -lws2_32 w.exe
Hello World
This way, the size of the "w.exe" is 4.61MB.
In Gambit-C manual documents 3. The Gambit Scheme compiler 3.4 Link files ... A "Hello World" program built this way can be as small as 5 Kbytes. ...
Could you please teach me how to built program as small as 5 Kbytes one.
Thanks in advance.
Afficher les réponses par date
You need to configure Gambit using --enable-shared, i.e.
./configure --enable-single-host --enable-shared make
This will build a DLL for the Gambit runtime library, so that the .exe doesn’t contain the runtime library.
Marc
On Jan 18, 2015, at 9:54 PM, Ryuho Yokoyama ryuho8@ybb.ne.jp wrote:
I built a "Hello World" program as follows,
type h.scm
(display "Hello ")
type w.scm
(display "World")
gsc -link h w gsc -obj h.c w.c w_.c gcc -o w.exe h.o w.o w_.o C:/Gambit-C_64bit/v4.7.3/lib/libgambc.a -lws2_32 w.exe
Hello World
This way, the size of the "w.exe" is 4.61MB.
In Gambit-C manual documents 3. The Gambit Scheme compiler 3.4 Link files ... A "Hello World" program built this way can be as small as 5 Kbytes. ...
Could you please teach me how to built program as small as 5 Kbytes one.
Thanks in advance.
Gambit-list mailing list Gambit-list@iro.umontreal.ca https://webmail.iro.umontreal.ca/mailman/listinfo/gambit-list
Thank you very much for replying.
I downloaded the "gambc-v4_7_3.gz", then
$ ./configure --enable-single-host --enable-shared $ make
I could get a "libgambc.dll" now.
type h.scm
(display "Hello ")
type w.scm
(display "World")
gsc -link h w gsc -obj h.c w.c w_.c gcc -o w.exe h.o w.o w_.o libgambc.dll -lws2_32 w.exe
Hello World
This time the size of the "w.exe" is 136KB. It's very small.
Thank you very much again for your help.
-----Original Message----- From: Marc Feeley Sent: Monday, January 19, 2015 1:51 PM To: Ryuho Yokoyama Cc: gambit-list@iro.umontreal.ca Subject: Re: [gambit-list] How can built a small as 5 Kbytes "Hello World" program ?
You need to configure Gambit using --enable-shared, i.e.
./configure --enable-single-host --enable-shared make
This will build a DLL for the Gambit runtime library, so that the .exe doesn窶冲 contain the runtime library.
Marc
On Jan 18, 2015, at 9:54 PM, Ryuho Yokoyama ryuho8@ybb.ne.jp wrote:
I built a "Hello World" program as follows,
type h.scm
(display "Hello ")
type w.scm
(display "World")
gsc -link h w gsc -obj h.c w.c w_.c gcc -o w.exe h.o w.o w_.o C:/Gambit-C_64bit/v4.7.3/lib/libgambc.a -lws2_32 w.exe
Hello World
This way, the size of the "w.exe" is 4.61MB.
In Gambit-C manual documents 3. The Gambit Scheme compiler 3.4 Link files ... A "Hello World" program built this way can be as small as 5 Kbytes. ...
Could you please teach me how to built program as small as 5 Kbytes one.
Thanks in advance.
Gambit-list mailing list Gambit-list@iro.umontreal.ca https://webmail.iro.umontreal.ca/mailman/listinfo/gambit-list
On Mon, 19 Jan 2015 15:28:19 +0900, Ryuho Yokoyama wrote:
Thank you very much for replying.
I downloaded the "gambc-v4_7_3.gz", then
$ ./configure --enable-single-host --enable-shared $ make
I could get a "libgambc.dll" now.
type h.scm
(display "Hello ")
type w.scm
(display "World")
gsc -link h w gsc -obj h.c w.c w_.c gcc -o w.exe h.o w.o w_.o libgambc.dll -lws2_32 w.exe
Hello World
This time the size of the "w.exe" is 136KB. It's very small.
How can this possibly be considered "small" for such a trivial task, let along *very* small?
That's three times the entire RAM of the first machine I ran a HelloWorld program on!
I really wonder what is filling up all those K!
-- hendrik
On 01/19/2015 05:04 PM, Hendrik Boom wrote:
On Mon, 19 Jan 2015 15:28:19 +0900, Ryuho Yokoyama wrote:
This time the size of the "w.exe" is 136KB. It's very small.
How can this possibly be considered "small" for such a trivial task, let along *very* small?
That's three times the entire RAM of the first machine I ran a HelloWorld program on!
I really wonder what is filling up all those K!
On Ubuntu 14.10, with all updates:
firefly:~/programs/gambit/norvig-spell/gambit> cat hello.scm (display "Hello World!\n") firefly:~/programs/gambit/norvig-spell/gambit> gsc -exe hello firefly:~/programs/gambit/norvig-spell/gambit> ll hello -rwxrwxr-x 1 lucier lucier 10536 Jan 19 21:44 hello* firefly:~/programs/gambit/norvig-spell/gambit> ./hello Hello World! firefly:~/programs/gambit/norvig-spell/gambit> gsc -v \v4.7.3 20141017031152 x86_64-unknown-linux-gnu "./configure '--enable-single-host' '--enable-shared' '--enable-multiple-versions' '--enable-char-size=1'"
Brad
On 01/19/2015 09:45 PM, Bradley Lucier wrote:
On 01/19/2015 05:04 PM, Hendrik Boom wrote:
On Mon, 19 Jan 2015 15:28:19 +0900, Ryuho Yokoyama wrote:
This time the size of the "w.exe" is 136KB. It's very small.
How can this possibly be considered "small" for such a trivial task, let along *very* small?
That's three times the entire RAM of the first machine I ran a HelloWorld program on!
I really wonder what is filling up all those K!
On Ubuntu 14.10, with all updates:
firefly:~/programs/gambit/norvig-spell/gambit> cat hello.scm (display "Hello World!\n") firefly:~/programs/gambit/norvig-spell/gambit> gsc -exe hello firefly:~/programs/gambit/norvig-spell/gambit> ll hello -rwxrwxr-x 1 lucier lucier 10536 Jan 19 21:44 hello* firefly:~/programs/gambit/norvig-spell/gambit> ./hello Hello World! firefly:~/programs/gambit/norvig-spell/gambit> gsc -v \v4.7.3 20141017031152 x86_64-unknown-linux-gnu "./configure '--enable-single-host' '--enable-shared' '--enable-multiple-versions' '--enable-char-size=1'"
Brad
I forgot:
firefly:~/programs/gambit/norvig-spell/gambit> strip hello firefly:~/programs/gambit/norvig-spell/gambit> ll hello -rwxrwxr-x 1 lucier lucier 7352 Jan 19 22:18 hello* firefly:~/programs/gambit/norvig-spell/gambit> ./hello Hello World!
Brad
On Mon, Jan 19, 2015 at 09:45:16PM -0500, Bradley Lucier wrote:
On 01/19/2015 05:04 PM, Hendrik Boom wrote:
On Mon, 19 Jan 2015 15:28:19 +0900, Ryuho Yokoyama wrote:
This time the size of the "w.exe" is 136KB. It's very small.
How can this possibly be considered "small" for such a trivial task, let along *very* small?
That's three times the entire RAM of the first machine I ran a HelloWorld program on!
I really wonder what is filling up all those K!
On Ubuntu 14.10, with all updates:
firefly:~/programs/gambit/norvig-spell/gambit> cat hello.scm (display "Hello World!\n") firefly:~/programs/gambit/norvig-spell/gambit> gsc -exe hello firefly:~/programs/gambit/norvig-spell/gambit> ll hello -rwxrwxr-x 1 lucier lucier 10536 Jan 19 21:44 hello*
That's much smaller than the 136KB mentioned in the post I was replying to.
" This time the size of the "w.exe" is 136KB. It's very small.
Good job.
Now I really wonder what was going on in the 136KB, or whether 136KB was a typo.
-- hendrik
On Jan 20, 2015, at 9:55 AM, Hendrik Boom hendrik@topoi.pooq.com wrote:
On Mon, Jan 19, 2015 at 09:45:16PM -0500, Bradley Lucier wrote:
On 01/19/2015 05:04 PM, Hendrik Boom wrote:
On Mon, 19 Jan 2015 15:28:19 +0900, Ryuho Yokoyama wrote:
This time the size of the "w.exe" is 136KB. It's very small.
How can this possibly be considered "small" for such a trivial task, let along *very* small?
That's three times the entire RAM of the first machine I ran a HelloWorld program on!
I really wonder what is filling up all those K!
On Ubuntu 14.10, with all updates:
firefly:~/programs/gambit/norvig-spell/gambit> cat hello.scm (display "Hello World!\n") firefly:~/programs/gambit/norvig-spell/gambit> gsc -exe hello firefly:~/programs/gambit/norvig-spell/gambit> ll hello -rwxrwxr-x 1 lucier lucier 10536 Jan 19 21:44 hello*
That's much smaller than the 136KB mentioned in the post I was replying to.
" This time the size of the "w.exe" is 136KB. It's very small.
Good job.
Now I really wonder what was going on in the 136KB, or whether 136KB was a typo.
-- hendrik
It is probably the ws2_32 library that is statically linked. But frankly on modern machines the difference in space between 5 MB (static link) and 5 KB (shared libs) doesn’t really matter very much. I almost always favour a static link because it avoids the headache of setting up the shared lib path, version compatibility, etc. Moreover, it is probably marginally faster to load the executable code from a single file.
Marc