Mail Archives: djgpp/1997/10/01/07:33:02
Arthur Bredrick <sammy AT blast DOT net> wrote in article
<EHCBzp DOT JCn AT nonexistent DOT com>...
> I am completely new to DJGPP and relatively inexperienced with
C, so I have
> a few questions. I downloaded Martynas Kunigelis' keyboard
interrupt
> handler example and in the keyboard.s file are the following
declarations:
>
> .extern ___djgpp_base_address
> .extern ___djgpp_ds_alias
> .extern ___djgpp_dos_sel
>
> Would anyone tell me where these come from and what they are
used for?
>
> Another question not DJGPP specific: Why do extra underscores
precede
> identifiers when interfacing between assembly and c? For
example, the
> assembly function _keyboard_init would be c-callable as just
keyboard_init,
> without the extra underscore. Thanks for any help.
>
> Art
Hi Art,
This is necessary for C compilers which generate assembly
language and use an assembler as part of the translation. If
the compiler did not do this, you would have to be very careful
in writing your code not to give any variables or functions
names which happen to be reserved words for the assembler (like
EAX, JMP, and so on), or they would cause errors in the
assembler.
Jack
- Raw text -