Static memory allocation and portability

I read. Static memory allocation is performed at compile time.

Is "allocated address" used when creating executable files?

Now, I doubt how memory is allocated when the executable code is fully ported to the new system.

I searched for it, but I did not receive a response online.

+3
source share
1 answer

Well, it totally depends on the circumstances, whether your executable file can run on your new system or not. Each operating system defines its own exectuable file format. For example, here is how exe windows look. There is a reason why they are called portable executable files.

When your compiler creates such an executable file, it first compiles your C code into the appropriate assembly of your target architecture, and then packs it into the target executable file format. Static memory allocations find their place in this format.

exe , . , .

: . , , (, Mac OS Rosetta PowerPC x86). 64/32 . ( ), , (java vm,.net CLR), , , .

+3

Source: https://habr.com/ru/post/1743983/


All Articles