The MASM Forum Archive 2004 to 2012

General Forums => The Workshop => Topic started by: D.F. on October 30, 2011, 03:29:40 PM

Title: Replace std::vector with ...?
Post by: D.F. on October 30, 2011, 03:29:40 PM
Hi all,
I'm porting application in C++ to MASM. In my C++ application I have:
vector<PESection *> Sections;
How to write this in MASM?

Regards, David
Title: Re: Replace std::vector with ...?
Post by: qWord on October 30, 2011, 04:30:45 PM
Sections is a pointer to a dynamic pointer-array:
mov edi,alloc(SIZEOF PVOID)
; edi = Sections = ptr ptr PESection 
; PVOID ptr [edi][0] = ptr PESection 
Title: Re: Replace std::vector with ...?
Post by: ToutEnMasm on October 30, 2011, 04:57:02 PM

Better than answer questions one by one add:
/FA           in  project ---->Property ---> c++ --->commande line
Build the project
open  a file and you got an asm file like this:
Quote
; Line 58
   push   OFFSET $SG4191
   mov   eax, DWORD PTR _p1$[ebp]
   push   eax
   call   _strcpy
   add   esp, 8
; Line 60
   push   34               ; 00000022H
   call   _malloc
   add   esp, 4
   mov   DWORD PTR _p2$[ebp], eax
And all your questions are answered

Title: Re: Replace std::vector with ...?
Post by: D.F. on October 30, 2011, 04:58:50 PM
(http://img291.imageshack.us/img291/2152/thankstu.png)

Thanks!