Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Learning D

You're reading from   Learning D Leverage the modern convenience and modelling power of the D programming language to develop software with native efficiency

Arrow left icon
Product type Paperback
Published in Nov 2015
Publisher
ISBN-13 9781783552481
Length 464 pages
Edition 1st Edition
Arrow right icon
Author (1):
Arrow left icon
Michael Parker Michael Parker
Author Profile Icon Michael Parker
Michael Parker
Arrow right icon
View More author details
Toc

Table of Contents (13) Chapters Close

Preface 1. How to Get a D in Programming 2. Building a Foundation with D Fundamentals FREE CHAPTER 3. Programming Objects the D Way 4. Running Code at Compile Time 5. Generic Programming Made Easy 6. Understanding Ranges 7. Composing Functional Pipelines with Algorithms and Ranges 8. Exploring the Wide World of D 9. Connecting D with C 10. Taking D Online 11. Taking D to the Next Level Index

Binding D to C


The first step that must be taken when implementing a binding to a C library is to decide whether it will be a static or dynamic binding. The former requires nothing more than the translation of all of the C types, global variables, and function signatures. The latter additionally requires a supporting API to load a shared library into memory. We'll cover both approaches in this section.

Once the type of binding has been settled, then begins the work of translating the C headers. This requires enough familiarity with C to understand not just the types and function signatures, but also the preprocessor definitions. While we'll cover some common preprocessor usage to look out for and how to translate it to D, there's not enough room here to provide a full tutorial on C preprocessor directives. Those readers unfamiliar with C are strongly advised to take the time to learn some of the basics before taking on the task of translating any C headers.

There are two tools in the D ecosystem...

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime
Banner background image