CWrap - higher abstraction level for calling C functions

Jacob Carlborg doob at me.com
Mon Feb 20 11:52:04 PST 2012


On 2012-02-20 16:34, Gour wrote:
> 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
>

As I understand it, CWrap provides more than just bindings for a C 
function. SWIG or dstep could output CWrap bindings.

-- 
/Jacob Carlborg


More information about the Digitalmars-d-announce mailing list