Mail Archives: djgpp/1999/12/04/12:55:56
From: | "Stefan Viljoen" <rylan AT intekom DOT com>
|
Newsgroups: | comp.os.msdos.djgpp
|
Subject: | Re: Some questions
|
Date: | Sat, 4 Dec 1999 09:12:17 +0200
|
Organization: | The South African Internet Exchange
|
Lines: | 77
|
Message-ID: | <82bfqv$2cf$2@ctb-nnrp1.saix.net>
|
References: | <944167327 AT p25 DOT f21 DOT n452 DOT z2 DOT FIDOnet DOT ftn>
|
NNTP-Posting-Host: | pc36-01-p01.nt.saix.net
|
X-Trace: | ctb-nnrp1.saix.net 944325279 2447 155.239.194.1 (4 Dec 1999 16:34:39 GMT)
|
X-Complaints-To: | abuse AT saix DOT net
|
NNTP-Posting-Date: | 4 Dec 1999 16:34:39 GMT
|
X-Priority: | 3
|
X-MSMail-Priority: | Normal
|
X-Newsreader: | Microsoft Outlook Express 5.00.2014.211
|
X-MimeOLE: | Produced By Microsoft MimeOLE V5.00.2014.211
|
To: | djgpp AT delorie DOT com
|
DJ-Gateway: | from newsgroup comp.os.msdos.djgpp
|
Reply-To: | djgpp AT delorie DOT com
|
Alexey Gaev <Alexey DOT Gaev AT p25 DOT f21 DOT n452 DOT z2 DOT fidonet DOT org> wrote in message
news:944167327 AT p25 DOT f21 DOT n452 DOT z2 DOT FIDOnet DOT ftn...
> Second question: Is there any kind of Language Reference in the package?
For
> example, I want to know if I can tell the compiler to pass values to
functions
> in specified registers, like I did in WATCOM: #pragma aux MyFunc parm
[eax]...
This is not strictly a "DJGPP" question (huh?!) When you are looking to
interface GCC with assembly code in DJGPP, as regards parameter passing you
just declare the function prototype in C like you were coding it in C
void test(int param1, int param2);
then, if for example you are using NASM to do the external assembly, you
just pop the parameters off the stack - each is
stored as a doubleword. To access param1
push ebp
mov ebp,esp
mov eax,[ebp] ;param1 in eax
mov ebx,[ebp+4] ;param2
mov ebx,[ebp+8] ;+8 gives param3
mov ebx,[ebp+12] ;+12 gives param4
mov esp,ebp
pop ebp
ret
Untested! Check these for accuracy. Function result you want to return into
a DJGPP module goes into eax. Hope this is correct and helps some!
> Third: is there any way to link programs on DJGPP with .obj files,
created,
> for example, by TASM?
Not that I am aware of - M$'s .OBJ fle format is incompatible with the COFF
format which is DJGPP object format. You have to either convert external
code into DJGPP compilable C code, or if it is external assembly convert it
to NASM or DJGPP's inline AT&T assembly. (shudder!)
> And, finally: don't you think that 104 Kb for "Hello, world" program,
even
> with debug information, is too much? ;) WATCOM C gives me 31 Kb in the
same
> conditions (of course, not counting dos4gw.exe ;).
There are two ways in which you can get a hello world down to +- 30k
(exactly Watcom size):
1. Use the -s switch on the GCC command line.
The -s switch strips debug info from the final .EXE:
gcc -o test.exe test.c -s
2. Use an .EXE file compressor like DJP or UPX.
DJP can be found on the same sites where DJGPP is downloadable from - it is
a very nice EXE file compressor that can compress DJGPP .EXE files very
well. UPX is a universal .EXE file compressor that is reputed to be quite
nice too.
Hope this helped some!
--
This message courtesy of
RylanNet rylan AT intekom DOT co DOT za
http://home.intekom.com/rylan/
--
StarWars for ever!.
- Raw text -