View mode: basic / threaded / horizontal-split · Log in · Help
March 30, 2005
calling dll functions
hi,

how would one make a call to a dll function, that does not have a leading
underscore? i do not have a .lib for the dll.

thanx in advance

richard
March 31, 2005
Re: calling dll functions
"richard koch" <richard_member@pathlink.com> wrote in message 
news:d2eimb$1euv$1@digitaldaemon.com...
> how would one make a call to a dll function, that does not have a leading
> underscore? i do not have a .lib for the dll.

I had this problem with a DLL; I solved it with a .def file.

Create a .def file (if you don't have one already), and in it, place the 
following:

IMPORTS
_name=dllname.name

So, if a function in blah.dll is called "Print", but D is looking for 
something named "_Print", you would write:

_Print=blah.Print

This sort of creates an alias, so that the linker can translate from the 
underscored name to the actual name.

Then just include the .def file on the commandline when you compile your 
program.
Top | Discussion index | About this forum | D home