PaulWDent
Electrical
- Apr 22, 2013
- 4
I have been programming in FORTRAN for 47 years, from FORTRAN II up to Compaq Visual Fortran (CVF) and IVF, but recently came up against this simple thing I wanted to do, which I cannot solve either in FORTRAN or Assembler.
I have the address of a routine that I want to call (it's in a .DLL provided by somebody else).
I have the address as a 32 bit value in a Fortran Integer SUBNAM.
But you cannot write CALL SUBNAM( argument list )
This is because I actually want an indirect call, not to the address of SUBNAM, but to the address it contains.
So I went into assembler and passed SUBNAM in as an argument, and tried to JMP to that address after saving a return address on the stack. I also tried pushing it on the stack and just doing a RET.
No dice. ACCESS VIOLATION!!
One reason may be that the assembly code may be trying to jump to an absolute address, but this is not allowed. You are only allowed to touch virtual addresses. And user ring programs are not allowed to have access to the mapping from one to the other.
Does anyone know how to solve this?
Of course this is all Microsoft and Intel's fault for making such a dog's breakfast of the PC programming model.
I have the address of a routine that I want to call (it's in a .DLL provided by somebody else).
I have the address as a 32 bit value in a Fortran Integer SUBNAM.
But you cannot write CALL SUBNAM( argument list )
This is because I actually want an indirect call, not to the address of SUBNAM, but to the address it contains.
So I went into assembler and passed SUBNAM in as an argument, and tried to JMP to that address after saving a return address on the stack. I also tried pushing it on the stack and just doing a RET.
No dice. ACCESS VIOLATION!!
One reason may be that the assembly code may be trying to jump to an absolute address, but this is not allowed. You are only allowed to touch virtual addresses. And user ring programs are not allowed to have access to the mapping from one to the other.
Does anyone know how to solve this?
Of course this is all Microsoft and Intel's fault for making such a dog's breakfast of the PC programming model.