Example of using C API from D?

Russel Winder russel at winder.org.uk
Thu Sep 6 16:31:49 UTC 2018


On Mon, 2018-09-03 at 11:41 +1200, rikki cattermole via Digitalmars-d-learn
wrote:
[…]
> 
> You won't need to actually fill out any c struct's that you don't need 
> either. Make them opaque as long as they are referenced via pointer and 
> not by value.

True. And indeed Fontconfig can mostly meet the "it's an opaque type based
system" but there are a few dark corners – most of which I need! 

[…]
> 
> Ugh, you do know that the linker which does all the hard work doesn't 
> know anything about the signature of the C function? That is the part 
> SharedLib replaces. You will of course define it with a proper signature 
> on D's side with a helpful cast :)

Not good enough to be honest, D is a statically typed language and so all
usage of functions should be checked against something other than a human
guess.

Anyway DStep has given me a Fontconfig D module that works nicely, and I will
check dpp as an alternative as soon as it builds on Debian Sid.
 
-- 
Russel.
===========================================
Dr Russel Winder      t: +44 20 7585 2200
41 Buckmaster Road    m: +44 7770 465 077
London SW11 1EN, UK   w: www.russel.org.uk

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: This is a digitally signed message part
URL: <http://lists.puremagic.com/pipermail/digitalmars-d-learn/attachments/20180906/dcabfa75/attachment.sig>


More information about the Digitalmars-d-learn mailing list