Date: Sat, 20 Sep 1997 13:24:35 +0000 ( ) From: "Gurunandan R. Bhat" To: Rob Kramer Cc: djgpp AT delorie DOT com Subject: Re: Calling C functions from assembly? In-Reply-To: <5vtmka$9ma$1@infa.central.susx.ac.uk> Message-Id: Mime-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Precedence: bulk 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