Mail Archives: djgpp/1999/01/30/16:17:03
From: | "Isaac Waldron" <waldroni AT lr DOT net>
|
Newsgroups: | comp.os.msdos.djgpp
|
Subject: | Accessing Constants in Assembly Code
|
Date: | Sat, 30 Jan 1999 15:23:09 -0500
|
Organization: | WorldPath Internet Services
|
Lines: | 64
|
Message-ID: | <78vpnt$pda1@ns1.lr.net>
|
NNTP-Posting-Host: | mere3-7.worldpath.net
|
X-Newsreader: | Microsoft Outlook Express 4.72.3155.0
|
X-MimeOLE: | Produced By Microsoft MimeOLE V4.72.3155.0
|
To: | djgpp AT delorie DOT com
|
DJ-Gateway: | from newsgroup comp.os.msdos.djgpp
|
Reply-To: | djgpp AT delorie DOT com
|
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
First off, here's the output from gcc -v:
C:\waldroni\projects\graphics>gcc -v
Reading specs from c:/djgpp/lib/specs
gcc version 2.8.1
OK, now I would like to know how to access a constant that is declared
in a .cc file with assembly language. I use NASM to create my object
files from .s files. I have a constant called VideoRAM that is
declared in a .cc file with this syntax:
const int VideoRAM = __dpmi_segment_to_descriptor(0xA000);
I want to be able to access this constant through an assembly routine
called _BlitPage, defined as follows:
*** file blit.s ***
extern _drawBuffer
extern _VideoRAM
segment .text
global _BlitPage
_BlitPage:
push ebp
mov ebp,esp
mov eax,[_VideoRAM]
mov es,ax
xor edi,edi
mov esi,_drawBuffer
mov ecx,32000
rep movsw
leave
ret
*** end of file ***
Now, when these two files are compiled and placed in libgraphics.a, a
graphics library I'm writing, things appear ok. But, the compile dies
at the linking stage with the following error:
C:\waldroni\projects\graphics>gxx -o testc.exe testc.cc -lgraphics
c:/djgpp/lib/libgraphics.a(blit.o)(.text+0x4):../src/blit.s: undefined
reference to `VideoRAM'
Has anyone else had this problem?
Thanks in advance,
Isaac Waldron
-----BEGIN PGP SIGNATURE-----
Version: PGP Personal Privacy 6.0.2
iQA/AwUBNrNqLVvPBN9ggn+IEQIs+QCgnAa4GsGV4d1bkBy2EvlVLRbJ/cQAoPJb
6AbdBzV3lMLbN7UYSkr++QLe
=AqLn
-----END PGP SIGNATURE-----
- Raw text -