File tree Expand file tree Collapse file tree 1 file changed +10
-4
lines changed Expand file tree Collapse file tree 1 file changed +10
-4
lines changed Original file line number Diff line number Diff line change @@ -5,16 +5,22 @@ $(SPEC_S Interfacing to C,
5
5
$(HEADERNAV_TOC)
6
6
7
7
$(P D is designed to fit comfortably with a C compiler for the target
8
- system. D makes up for not having its own VM by relying on the
9
- target environment's C runtime library. It would be senseless to
10
- attempt to port to D or write D wrappers for the vast array of C APIs
11
- available. How much easier it is to just call them directly.
8
+ system. It is able to call C functions directly without requiring
9
+ wrapper functions.
12
10
)
13
11
14
12
$(P This is done by matching the C compiler's data types, layouts,
15
13
and function call/return sequences.
16
14
)
17
15
16
+ $(P The $(DDLINK spec/importc, ImportC, ImportC) compiler extention lets you import or compile `.c` files directly. )
17
+
18
+ $(P Bindings for popular C libraries can be found in the
19
+ $(LINK2 https://dlang.org/phobos/index.html, standard library) and
20
+ $(LINK2 https://code.dlang.org/?sort=updated&limit=20&category=library.binding, package repository).)
21
+
22
+ $(P The rest of this page describes the manual, low-level side of interfacing with C.)
23
+
18
24
$(H2 $(LNAME2 calling_c_functions, Calling C Functions))
19
25
20
26
$(P C functions can be called directly from D. There is no need for
You can’t perform that action at this time.
0 commit comments