Shared libraries/DLLs
Neal Alexander
wqeqweuqy at hotmail.com
Thu Jan 31 23:39:16 PST 2008
Unknown W. Brackets wrote:
> Sorry, I want to be able to compile and run that. It refuses to do so.
>
> It wants to link against loader.obj, except that defeats the purpose of
> it being dynamic. I can add IMPORTS to the def, but then it has to be
> static.
>
> I want to dynamically link, and also call functions from the code that
> is dynamically linking.
>
> Sorry I was unclear.
>
> -[Unknown]
>
>
> Jarrett Billingsley wrote:
>> "Unknown W. Brackets" <unknown at simplemachines.org> wrote in message
>> news:fnu7l0$2p5l$1 at digitalmars.com...
>>
>>> This appears to work on Linux. I expected it might work (or there
>>> might be some way to coax it to work) on Windows. It seems logical,
>>> even not having used the LoadLibrary/etc. stuff before. The library
>>> needs to access the caller's functions.
>>>
>>> It does appear I can make it at least *compile* (but not run) by
>>> adding an IMPORTS directive to the .def file of the library, but this
>>> clearly is intended for static linking. I'm wanting to load the DLL
>>> as a plugin, dynamically. Its name and location might change.
>>>
>>> Am I making some hopefully obvious and stupid mistake? Please tell
>>> me I don't actually have to send pointers to all the api functions to
>>> the DLL when calling it.
>>
>> So, uh, what _exactly_ is the problem? I don't think you ever said..
>>
If the settings used in your .def file aren't particular the DLL doesnt
work as expected. IIRC the def files in the digital mars DLL tutorial
diddnt work for me when i first looked at it.
maybe try this instead:
-----------------------------------
LIBRARY "x.dll"
DESCRIPTION 'x.dll'
EXETYPE NT
CODE PRELOAD
DATA PRELOAD
More information about the Digitalmars-d-learn
mailing list