CWrap - higher abstraction level for calling C functions

Gour gour at atmarama.net
Mon Feb 20 07:34:35 PST 2012


On Mon, 20 Feb 2012 18:02:49 +0400
Denis Shelomovskij <verylonglogin.reg at gmail.com> wrote:

Hello Denis,

> D has complete (IMHO) compiler support for calling C functions (using 
> extern(C)). But there is a lack of library support. 

I'm glad you're working on (another) bindings tool being aware that it's
not reasonable that D will cover all our library needs.

Otoh, I'm also concerned that using just wrappers over C code would
erode (potential) type-safety and advantage of using D in the first
place. (In our app we envision to use wXD for GUI, need bindings for 3rd
party C lib, using one of Sqlite3 wrappers...)

> Once original function is properly described in IDL, CWrap gives the 
> fallowing advantages:

If we eliminate htod which is Windows only and considering that manual
wrapping is not very attractive option, along with your list which sound
quite goo, my question is what would be some of pro/cons of CWrap in
comparison with e.g. SWIG and it's D support as well as with dstep
(https://github.com/jacob-carlborg/dstep) if our main objective would be
to keep some of D's advantages such as having higher-level (D-ish) API,
exception handling (insted of error-checking), type-safety etc.
available in our D bindings of C lib(s)?


Sincerely,
Gour

-- 
One who restrains his senses, keeping them under full control, 
and fixes his consciousness upon Me, is known as a man of 
steady intelligence.

http://atmarama.net | Hlapicina (Croatia) | GPG: 52B5C810
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: not available
URL: <http://lists.puremagic.com/pipermail/digitalmars-d-announce/attachments/20120220/510490d2/attachment.pgp>


More information about the Digitalmars-d-announce mailing list