cvs.gedasymbols.org/archives/browse.cgi   search  
Mail Archives: djgpp/1998/05/04/17:01:35

From: Xavi Cardona <xavicardona AT rocketmail DOT com>
Newsgroups: comp.os.msdos.djgpp
Subject: assembler & C variables
Date: Mon, 04 May 1998 09:24:58 -0700
Organization: none
Lines: 23
Message-ID: <354DEBDA.6612@rocketmail.com>
Reply-To: xavicardona AT rocketmail DOT com
NNTP-Posting-Host: caladan.arrakis.es
Mime-Version: 1.0
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

!
I'm starting assembler programming. I have read all FAQs,docs & txt
about this, but I don't know why this program not works:

/* Program asmvar.cc: this program puts 10 in myvar */
#include <stdio.h>
main()
{char myvar =0;
__asm__ __volatile__ ("movb $10,_myvar"
        	      :
      	              :
      	              :"memory");
printf("i=%d\n",myvar);
}

I compile it with:
	gcc -O2 -o asmvar.exe asmvar.cc

But, the result is: 
	In function main
		undefined reference to "_myvar"

Help me, please!

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019