link from a dll to another function in another dll?

maarten van damme maartenvd1994 at gmail.com
Thu Apr 21 09:31:56 PDT 2011


according to dllexp.exe (a dll examiner) my dll does not export any
functions.
So there is something wrong in my declaration:

pragma(lib,kernel33.lib);
extern(C){
export void * functionfromkernel33.lib () ;
...
}

How can one write this correctly?

2011/4/21 maarten van damme <maartenvd1994 at gmail.com>

> There is another problem, I don't know the return types of the functions
> from that dll, so I gave them the type "void *". I think this is incorrect.
> I've tried with the little knowledge I have from d and in the link is my
> kernel32.d. I have compiled it succesfully in a .dll but the application
> using that dll states that that dll isn't valid.
>
> thank you for taking your time to answer this question :) .
>
>
> http://dl.dropbox.com/u/15024434/kernel32.d
>
>
>> 2011/4/21 Robert Jacques <sandford at jhu.edu>
>>
>>> On Thu, 21 Apr 2011 07:49:14 -0400, maarten van damme <
>>> maartenvd1994 at gmail.com> wrote:
>>>
>>>  Hello, I'm back (I've been ill, nothing serious)
>>>> I woul really like a bit more explanation with that particular approach.
>>>> Would declaring the functions I want to keep from the renamed dll in a
>>>> extern(c) block and linking that to the renamed dll while also declaring
>>>> them as export work?
>>>> And the function I want to change I declare myself and write in d?
>>>>
>>>> I haven't really mastered the d language and I'm simply playing around
>>>> with
>>>> it, simply checking if I've understood it.
>>>>
>>>> 2011/4/18 Robert Jacques <sandford at jhu.edu>
>>>>
>>>>  On Mon, 18 Apr 2011 04:11:16 -0400, maarten van damme <
>>>>> maartenvd1994 at gmail.com> wrote:
>>>>>
>>>>>  The problem with that aproach would be that the functions are in
>>>>> another
>>>>>
>>>>>> location in the export table.
>>>>>> I've read that the locations need to stay exactly the same.
>>>>>> Am I wrong about this?
>>>>>>
>>>>>>
>>>>> I don't know for sure, but my gut would say that not knowing the exact
>>>>> layout of the DLL is half the point. In practice, I've used D with DLLs
>>>>> that
>>>>> have drastically added to/changed their layout (according to dumpbin)
>>>>> without a problem.
>>>>>
>>>>>
>>> Hmm... It should work, but I've never tried it. Def files allow you to
>>> rename DLL functions, so you could rename the single function you want to
>>> override something else, or leave it out entirely. The only thing to be
>>> careful of is call style and name mangling (i.e. System vs C, etc.)
>>>
>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puremagic.com/pipermail/digitalmars-d/attachments/20110421/27a512f7/attachment.html>


More information about the Digitalmars-d mailing list