News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

Exporting data

Started by srod, November 18, 2006, 09:07:46 PM

Previous topic - Next topic

srod

Hi,

this is taken literally straight from the GoAsm manual. But I'm a little unsure as to what happens when data is imported.

EXPORT DATA_VALUE DD 10


What does the following actually place into the eax register? Is it the offset of the data within the exporting module, or the value 10?

MOV EBX,[DATA_VALUE]       ;get pointer to DATA_VALUE
MOV EAX,[EBX]              ;get the value


Thanks.

Stephen.

donkey

Hi Stephen,

The example you gave will put 10 into the EAX register. Data that is exported from a dynamic library (DLL/OCX etc...) is imported by address. That is that the label you use is actually a pointer to the data. In the example it would move the address into EBX then by dereferencing it, move the data at that address (in this case 10) into EAX. If you were doing the same thing with a label in your local data section it would look like this...

mov ebx, offset DATA_VALUE
mov eax, [ebx]

However when external data is involved [DATA_VALUE] will yeild the offset directly.

Donkey
"Ahhh, what an awful dream. Ones and zeroes everywhere...[shudder] and I thought I saw a two." -- Bender
"It was just a dream, Bender. There's no such thing as two". -- Fry
-- Futurama

Donkey's Stable

srod

Excellent, that is what I hoped was happening.

Thanks Donkey.

:8)