VC++ gives Invalid function reference
-
Hi, all :) I am trying to write a little experiment program where it is supposed to copy a function (the bytecode) during runtime. But I have encountered a problem, which seems to be VC++ fault (at least in debug mode). Whenever you want a function reference, VC++ gives you a different memory location than the where actual function is located. VC++ gives you a location of a jump instruction, which jumps to the actual function. But because I want the exact functions location in memory I am experiencing a problem. I hope you understood my problem (if not please reply, so I can clarify my self). Any ideas on how to avoid the problem with getting the wrong location? Thanks in Advance Aidman » over and out We haven't inherited Earth from our parents, instead we have borrowed her from our children; an old Indian saying.
-
Hi, all :) I am trying to write a little experiment program where it is supposed to copy a function (the bytecode) during runtime. But I have encountered a problem, which seems to be VC++ fault (at least in debug mode). Whenever you want a function reference, VC++ gives you a different memory location than the where actual function is located. VC++ gives you a location of a jump instruction, which jumps to the actual function. But because I want the exact functions location in memory I am experiencing a problem. I hope you understood my problem (if not please reply, so I can clarify my self). Any ideas on how to avoid the problem with getting the wrong location? Thanks in Advance Aidman » over and out We haven't inherited Earth from our parents, instead we have borrowed her from our children; an old Indian saying.
Is the function you are copying inside a DLL? John
-
Is the function you are copying inside a DLL? John
-
Hi, all :) I am trying to write a little experiment program where it is supposed to copy a function (the bytecode) during runtime. But I have encountered a problem, which seems to be VC++ fault (at least in debug mode). Whenever you want a function reference, VC++ gives you a different memory location than the where actual function is located. VC++ gives you a location of a jump instruction, which jumps to the actual function. But because I want the exact functions location in memory I am experiencing a problem. I hope you understood my problem (if not please reply, so I can clarify my self). Any ideas on how to avoid the problem with getting the wrong location? Thanks in Advance Aidman » over and out We haven't inherited Earth from our parents, instead we have borrowed her from our children; an old Indian saying.
Not sure if this will disable it in Debug mode, but you can try turning off the "Link incrementally" option on the Linker tab of the project settings. However, it may be that in debug mode it always uses the jmp instruction, regardless of the setting, so it can link faster. Chris Richardson
Terrain Software -
nop, a regular exe Aidman » over and out We haven't inherited Earth from our parents, instead we have borrowed her from our children; an old Indian saying.
I brought this up because I know dlls use a lot of JMP instructions into the actual code. The thing is that this is perfectly legal but not what you would expect. You may have to play with the compiler settings to turn off that feature. John
-
Not sure if this will disable it in Debug mode, but you can try turning off the "Link incrementally" option on the Linker tab of the project settings. However, it may be that in debug mode it always uses the jmp instruction, regardless of the setting, so it can link faster. Chris Richardson
Terrain Software