Bug 4779 – www.d-programming-language.org "Interfacing to C" should make clear how to do callbacks

Status
RESOLVED
Resolution
FIXED
Severity
enhancement
Priority
P2
Component
dlang.org
Product
D
Version
D2
Platform
Other
OS
All
Creation time
2010-08-31T21:59:00Z
Last change time
2012-12-08T10:07:13Z
Assigned to
nobody
Creator
cruxic

Comments

Comment #0 by cruxic — 2010-08-31T21:59:06Z
Callbacks are an essential part of interfacing with C code. The "Interfacing to C" document comes close to telling you how to setup a callback but assumes the reader knows about the "function" keyword already. In the section where it says: "C code can correspondingly call D functions, if the D functions use an attribute that is compatible with the C compiler, most likely the extern (C)..." There should be an example showing how to setup the binding like so: extern (C) void registerSomeCallback(void function(int,int) yourFunc); And then it should hyperlink to the "Delegates, Function Pointers, and Closures" section in /function.html. I'd be glad to make these changes myself if you like.
Comment #1 by github-bugzilla — 2012-12-08T10:06:01Z