From: Andrew Crabtree Message-Id: <199704171750.AA094619458@typhoon.rose.hp.com> Subject: Re: spawning NASM from GCC? To: FLEGEL AT physnet DOT uni-hamburg DOT de (Michael Flegel) Date: Thu, 17 Apr 1997 10:50:57 PDT Cc: djgpp AT delorie DOT com In-Reply-To: ; from "Michael Flegel" at Apr 17, 97 12:10 (noon) Precedence: bulk > > I was just wondering if there is any way in which I can spawn NASM > instead of AS for inline-assembly in GCC. Because, frankly AT&T syntax is Sorry, no help here. > Oh, and a related question: How do I make procs public in NASM, and how > do I include it in GCC? (extrn void _procedure(void) ??) In NASM, labels behave by default as though they had been declared static in C. To make a symbol exportable in NASM put a [GLOBAL myFunc] for it at the top of the assembly file ( for variables and procedures). Remember to name your assembly language procedures with an underscore so gcc maps them correctly. When you do your external function declaration use the same syntax as your assembly routine expects. If you are returning a value in eax declare int myFunct(arg1,arg2,...) If you are not returning a value then declare void myFunct. Here is a very simple example test.c #include extern int mulByTwo(int num1); int main(void) { int i, j; i = 3; j = mulByTwo(i); printf("%d\n",j); } routine.s [BITS 32] [GLOBAL _mulByTwo] [SECTION .text] _mulByTwo : mov EAX,[ESP+4]; imul 2; ret; I can't test this here at work so some of the syntax may not be exactly correct. Andrew