Date: Fri, 22 Apr 94 11:16:40 -0400 From: dj AT ctron DOT com (DJ Delorie) To: dwang AT ee DOT WPI DOT EDU Cc: djgpp AT sun DOT soe DOT clarkson DOT edu > I have a very simple problem but I can't figure out so far. That's about > the combination of in-line assembly language within C programs under GCC 2.5.7. > An example is as follows, that's in i386 version: > asm("movb data,%ax"); > here "data" is previously used in C routine. The GCC compiler told me that > "undefined reference to 'data'". In fact, however, 'data' was defined in C > routine. Try asm("movb _data,%ax"). A better solution is asm("movl %1,%%eax" : "r" (data)); Note that "movb" and "%ax" are incombatible. "movb" is for bytes and "%ax" is a 16-bit word.