Windows pc relative code generation

D

davide galassi

Hi there,
i start to getting mad with this... The question it's easy. But i
spent the last days googling looking for an answer...but looks like no-
one ever had this problem...
I have to:
Generate under windows a binary that references the static variables
in the source code using PC-relative addressing.

I'm not writing some kind of virus or something strange but i simply
have to implement a pluggable form of shaders for a my graphic engine.

i want that given for example this C source:

float gWVP;

float VS( float in )
{
return gWVP*10;
}

the function reference the variable gWVP in a PC relative way or any
position independent way...

The output of the compilation process have to be a raw binary. so no
answers about DLLs, and other relocatable formats.

So I NEED a compiler capable to generate PC relative code under
windows...after the compilation i will transform the generated
executable into binary via OBJCOPY....

Exist such a compiler? or i have to find other ways???

I already tried with gcc and vs.
Thanks a lot
 
A

Alf P. Steinbach

Hi there,
i start to getting mad with this... The question it's easy. But i
spent the last days googling looking for an answer...but looks like no-
one ever had this problem...
I have to:
Generate under windows a binary that references the static variables
in the source code using PC-relative addressing.

I'm not writing some kind of virus or something strange but i simply
have to implement a pluggable form of shaders for a my graphic engine.

Pluggable binary modules in C or C++ = shared libraries, in Windows DLLs.

i want that given for example this C source:

float gWVP;

float VS( float in )
{
return gWVP*10;
}

the function reference the variable gWVP in a PC relative way or any
position independent way...

The output of the compilation process have to be a raw binary. so no
answers about DLLs, and other relocatable formats.

But why do you want to create your own relocatable format when you can just use
a DLL?

So I NEED a compiler capable to generate PC relative code under
windows...after the compilation i will transform the generated
executable into binary via OBJCOPY....

What exactly will you transform it to?

Exist such a compiler? or i have to find other ways???

I already tried with gcc and vs.

If you really want to go that route then I think the only answer is assembly
language.

But it would help if you could explain why you think you can't make do with DLLs.


Cheers & hth.,

- Alf
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,065
Latest member
OrderGreenAcreCBD

Latest Threads

Top