Someone said in a message, to make your own shared data area inside your prog, but how do you do that? The code segment could be used, except its marked as readonly. And it is not mentioned anywhere in the masm32.hlp file on how to make your own segments or modify default values using masm, i know that say; "newseg SEGMENT para public" does work, but does anyone know of the full syntax for the segment operator. Or another method to make a shared segment? Thanks
First, create a new segment, like this:
ShareData segment 'data' FirstInstance dd TRUE ; initialize to TRUE ShareData ends .code .if FirstInstance==TRUE ; I'm the first instance mov FirstInstance,FALSE ; modify the value so the next ; instance knows it's not the first .else .endifThen, in your linker option: link ... /SECTION:ShareData,S /SECTION switch controls the attribute of the section. In our case, we set it to S meaning the section is a shared section.