Library linking (request)

Jeremy Jeremy_member at pathlink.com
Mon Feb 27 20:37:41 PST 2006


In article <du0hnt$a5d$1 at digitaldaemon.com>, Jarrett Billingsley says...
>
>"Jarrett Billingsley" <kb3ctd2 at yahoo.com> wrote in message 
>news:du0hji$a2a$1 at digitaldaemon.com...
>> import "alleg40.dll";
>
>There is a problem with this.

I was worried somebody would say that :~(

>
>Unless the library (static or dynamic) uses some kind of known name 
>mangling, D won't be able to deduce the function signatures.
>
>For example, I know a lot of C-compatible libraries use C name mangling, 
>which is just
>
>name at 8
>
>Or something, where 8 is the number of bytes passed into the function.  No 
>indication of return type, param types, etc.

Hrm.. so how are those libraries referenced? I assume these are the cases where
the library comes with a .h file that has the correct symbol names?

Hrm.. maybe that 'reference' keyword would work something like:

reference <library file> [, symbol defintion file]

if the second argument is missing ('symbol definition file') -- the compiler
will try to automatically extract symbol information and compile -- complaining
if there are undefined references (maybe the compiler can pick up symbol names
by these undefined references like "linkdef" does?)

if the second argument exists, then it will use that to grab more information
about the library (like a .h file would for C libraries -- isn't this what
current .def's do?)

I would like to help program this functionality if it would become part of the
standard :) I don't know where to begin, but I'm pretty good with C/C++ :-D

>
>It could only really be done with D libraries, and by then, you might as 
>well create your own D library format.  Which would still be cool. 
>

Yes yes :)

Jeremy



More information about the Digitalmars-d mailing list