Mail Archives: djgpp/1994/04/22/11:26:03
> 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.
- Raw text -