I'm trying to create a proxy dll( a dll forwarding all it's functions to another dll)<div>I renamed the dll I want to replace (let's call him foo) to oldfoo.dll</div><div>then I created the import library oldfoo.lib and created oldfoo.def with as syntax</div>
<div><br></div><div>"</div><div><div>LIBRARY         "oldfoo"</div><div><br></div><div>IMPORTS</div><div>internalbar=oldfoo.bar</div></div><div>...</div><div>"</div><div><br></div><div>and then I created a D file called foo.d with a valid dllmain and then an extern(c) block with in it the following syntax:</div>
<div><br></div><div>"</div><div>void * internalbar();</div><div>...</div><div><br></div><div>//////////////////////////////////</div><div>void *bar(){asm{naked;jmp internalbar;}}</div><div>...</div><div>"</div><div>
<br></div><div>and when I compile it I get the following error:</div><div><br></div><div>"</div><div><div>C:\Users\maarten\Desktop\workingdir>dmd foo.d oldfoo.def oldfoo.lib</div><div>OPTLINK (R) for Win32  Release 8.00.12</div>
<div>Copyright (C) Digital Mars 1989-2010  All rights reserved.</div><div><a href="http://www.digitalmars.com/ctg/optlink.html">http://www.digitalmars.com/ctg/optlink.html</a></div><div>OPTLINK : Warning 148: USE16/USE32 Mismatch : DGROUP</div>
<div>C:\D\dmd2\windows\bin\..\lib\SNN.lib(dllstart)</div><div> Error 83: Illegal frame on start address</div><div>OPTLINK : Warning 174: 32-bit Segments Inappropriate for 16-bit Segmented output</div><div><br></div><div>foo.obj(foo)</div>
<div> Error 35: Cannot Reach TARGET from FRAME at Relative 0002BH  from</div><div> Segment _TEXT</div><div> FRAME  = Frame of Group FLAT 0000</div><div> TARGET = External Symbol _D4core3sys7windows3dll18dll_process_detachFT4core3sys</div>
<div>7windows7windows6HANDLEbZv 00070H</div><div> FIXUPP Type = 32-bit Conditional JMP</div><div>--- errorlevel 2</div><div>"</div></div><div><br></div><div>Can someone point me a bit in the right direction? I've tried this in the past but then I understood nearly nothing about .def files an .lib files. Now that I know a bit more I wanted to take up the challenge again.</div>