Is there a way to switch section (.data .text .zzz) in _asm?
For example is it possible to compile data in the .text section inside a function?
It may seem like a silly thing, but lets say we are writing a program in C that is not arranged like normal C code would be. We want our code to CALL a function that will read the return address as an object pointer like this.
[Not tested -- this is just to get the concept so the question is more clear.]
// everything is __stdcall ... nothing is expected to actually work ... yet.
void* _getpointer(void *pObj); // fwd refs ok
void * an_object(void)
{
__asm{
call _getpointer
// return address will point here...
.text? 1234 // ??? anything like this in Pelles?
}
}
// and here's what returns the object pointer, for the record...
void* __declspec(naked) _getpointer(void *pObj)
{
__asm{ pop eax; ret } // returns to whatever called "an_object"
}
The idea here is to use the return address as a data pointer. Not effecient, lots of pipeline hits, apparently random alignment... I know. And that's not the point. Is it possible?
Anybody know how to do it?
.