Thread overview | |||||
---|---|---|---|---|---|
|
December 01, 2003 C linking to D | ||||
---|---|---|---|---|
| ||||
Anyone, Can D build binaries which are linkable from C? In other words can I link a bottom level D module/library etc. to a top level C program? Mark. |
December 01, 2003 Re: C linking to D | ||||
---|---|---|---|---|
| ||||
Posted in reply to Mark Brudnak | I can't see any reason why not, so long as you are using C-compatible types, i.e. ptrs not arrays, etc. "Mark Brudnak" <malibrud@provide.net> wrote in message news:bqedce$2af0$1@digitaldaemon.com... > Anyone, > > Can D build binaries which are linkable from C? In other words can I link a > bottom level D module/library etc. to a top level C program? |
December 03, 2003 Re: C linking to D | ||||
---|---|---|---|---|
| ||||
Posted in reply to Matthew Wilson | Matthew Wilson wrote:
> I can't see any reason why not, so long as you are using C-compatible types,
> i.e. ptrs not arrays, etc.
It is necessary to initialise the D runtime (GC, etc.) from the C environment. Then it is necessary to use extern(C) convention in D. Then write headers. Gets more cumbersome than not.
For more information on initialising and shutting down the runtime, see manual chapter on using WinMain entry point in D...
-eye
|
Copyright © 1999-2021 by the D Language Foundation