Library linking

Jarrett Billingsley kb3ctd2 at yahoo.com
Mon Feb 27 16:01:49 PST 2006


"Jeremy" <Jeremy_member at pathlink.com> wrote in message 
news:du03ir$2u1d$1 at digitaldaemon.com...
> Can there be something as simple as 'importlib (<type>) "<filename>"' in 
> the
> code? Say:
>
> importlib (dll) "alleg40.dll";
> importlib (a) "libusb.a";

Well, it's not _quite_ what you want, but it's better than nothing:

pragma(lib, "libusb.a");

This will tell the linker to link in the library, but you'll still have to 
define all the function signatures yourself.

And with DLLs, you can use implib to generate a .def file which can be 
passed on the command line to tell the linker where to find the functions, 
but again, you have to define all the function signatures.

Some people have been working on "auto-loading" symbols from static / 
dynamic libraries, but it's not part of the language yet.  I think a D 
object / library standard that had auto-loading of symbols would be great. 





More information about the Digitalmars-d mailing list