Mail Archives: djgpp/1997/09/20/21:23:33
On 19 Sep 1997, Rob Kramer wrote:
>
> Hi All,
>
> Can anyone tell me how I can call C functions from assembly code
You can refer to any external symbol (function name or variable name)
declared in a C file by prepending an underscore to the symbol and
declaring it as a global symbol. For example to call printf from within an
assembly routine declare it as so:
.globl _printf
and use it like so:
call _printf
> (or point me to an example)?
lots, really. take any C code which calls an extern function and compile
it with the -S option to see the assembly version of your code.
> I want to call a packet driver's software interrupt from
> within my assembly code, using the __dpmi_int() function.
then
.globl ___dpmi_int #note 3 underscores
..
..
call ___dpmi_int
taking care to push arguments on the stack correctly
I must warn you however that I too am new to assembly
Hope this helps
- Raw text -