News:

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

Quick Question: translate something from C

Started by RedXVII, March 22, 2006, 08:44:32 PM

Previous topic - Next topic

RedXVII

I know C pretty well. I cant get the C code im converting to compile  :'( so i thaught i'd just ask;
what does this C translate as in assembly,

functionname( (void**)&pData );

im more confused by the (void**) and what it represents.

Thanks  :U

asmfan

(void**) represents to pointer on pointer. For example you have a pointer on any data and abov means the addres of the pointer on data(&pData, as pData is (void*) type, then you get void**).
hope you understood me:),
Igor.
Russia is a weird place

asmfan

in assembly it can be like this:
Code:
.data
var1  dd  ?
var2  dd  var1
.code
lea  eax, var2  ;eax is void** since it dereferenced twice points on var1
Russia is a weird place

RedXVII

Errrr how many pointers is that

In your example, i presume var 2 points to var1.

Should i push pointer1 or pointer2?

Pointer1 -> pointer2 -> pData (-> Data)

So from your example - i should push pointer1, and make a new memory address for pointer2, right?

Thx  :U

asmfan

say var1 is Data, var2 is pointer on Data (void*) and eax is pointer on pointer (void**). Push the eax to get (void**) type.
Russia is a weird place

RedXVII


asmfan

Russia is a weird place