digitalmars.D.learn - creating a proxy dll
- maarten van damme (44/44) Oct 21 2011 I'm trying to create a proxy dll( a dll forwarding all it's functions to
I'm trying to create a proxy dll( a dll forwarding all it's functions to another dll) I renamed the dll I want to replace (let's call him foo) to oldfoo.dll then I created the import library oldfoo.lib and created oldfoo.def with as syntax " LIBRARY "oldfoo" IMPORTS internalbar=oldfoo.bar ... " 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: " void * internalbar(); ... ////////////////////////////////// void *bar(){asm{naked;jmp internalbar;}} ... " and when I compile it I get the following error: " C:\Users\maarten\Desktop\workingdir>dmd foo.d oldfoo.def oldfoo.lib OPTLINK (R) for Win32 Release 8.00.12 Copyright (C) Digital Mars 1989-2010 All rights reserved. http://www.digitalmars.com/ctg/optlink.html OPTLINK : Warning 148: USE16/USE32 Mismatch : DGROUP C:\D\dmd2\windows\bin\..\lib\SNN.lib(dllstart) Error 83: Illegal frame on start address OPTLINK : Warning 174: 32-bit Segments Inappropriate for 16-bit Segmented output foo.obj(foo) Error 35: Cannot Reach TARGET from FRAME at Relative 0002BH from Segment _TEXT FRAME = Frame of Group FLAT 0000 TARGET = External Symbol _D4core3sys7windows3dll18dll_process_detachFT4core3sys 7windows7windows6HANDLEbZv 00070H FIXUPP Type = 32-bit Conditional JMP --- errorlevel 2 " 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.
Oct 21 2011