Thread overview | |||||
---|---|---|---|---|---|
|
May 30, 2004 Using C libraries | ||||
---|---|---|---|---|
| ||||
Hello. I'm quite new to this "d"-thing, but it seems very interesting and i think i will use it, if i can clear a few things up. I have, based on the reading i have done, made the following assumptions, please correct me where i'm wrong. 1. D can link to C libraries. The standard c library have been wrapped(all functions redeclared with "extern (C) ...") in std.c.xxx-modules, so we can use them easily. 2. I cannot use functions from a c library unless i have declared them as extern (C) in my D source code. Structures in the c library that i want to use in my code have to be declared in my D code. |
May 30, 2004 Re: Using C libraries | ||||
---|---|---|---|---|
| ||||
Posted in reply to Anders Runesson | Anders Runesson wrote: > Hello. > I'm quite new to this "d"-thing, but it seems very interesting and i think i > will use it, if i can clear a few things up. I have, based on the reading i > have done, made the following assumptions, please correct me where i'm > wrong. > > 1. D can link to C libraries. The standard c library have been wrapped(all > functions redeclared with "extern (C) ...") in std.c.xxx-modules, so we can > use them easily. Correct. > > 2. I cannot use functions from a c library unless i have declared them as > extern (C) in my D source code. Structures in the c library that i want to > use in my code have to be declared in my D code. That's correct, too. How should the compiler know about the functions and structures if you don't do that? Stephan |
May 30, 2004 Re: Using C libraries | ||||
---|---|---|---|---|
| ||||
Posted in reply to Anders Runesson | "Anders Runesson" <arson@disoriented.org> wrote in message news:c9d1qt$6es$1@digitaldaemon.com... > Hello. > I'm quite new to this "d"-thing, but it seems very interesting and i think i > will use it, if i can clear a few things up. I have, based on the reading i > have done, made the following assumptions, please correct me where i'm wrong. > > 1. D can link to C libraries. The standard c library have been wrapped(all > functions redeclared with "extern (C) ...") in std.c.xxx-modules, so we can > use them easily. > > 2. I cannot use functions from a c library unless i have declared them as extern (C) in my D source code. Structures in the c library that i want to use in my code have to be declared in my D code. Both assumptions are correct. |
Copyright © 1999-2021 by the D Language Foundation