There's a lot of preprocessor stuff going on. Use nimterop to process that out 
and make your life easier.
    
    
    nimble install nimterop
    cd path/to/libgd/src
    toast --preprocess --recurse gd.h > gdfull.h
    c2nim gdfull.h
    
    
    Run

You could also use toast with \--pnim and it will generate nim output but it 
doesn't do as well as c2nim. Although, both still miss some symbols.

Here's the errors from nim check for toast's nim output:
    
    
    gdfull.nim(122, 21) Error: undeclared identifier: 'gdImage'
    gdfull.nim(142, 37) Error: undeclared identifier: 'gdIOCtxPtr'
    gdfull.nim(148, 44) Error: undeclared identifier: 'gdIOCtx'
    gdfull.nim(169, 40) Error: undeclared identifier: 'gdSourcePtr'
    gdfull.nim(207, 154) Error: undeclared identifier: 'gdFTStringExtraPtr'
    gdfull.nim(208, 40) Error: undeclared identifier: 'gdPointPtr'
    gdfull.nim(268, 46) Error: undeclared identifier: 'gdSinkPtr'
    gdfull.nim(301, 42) Error: undeclared identifier: 'gdScatterPtr'
    gdfull.nim(323, 45) Error: undeclared identifier: 'gdRect'
    
    
    Run

Here's c2nim's nim check output:
    
    
    gdfull.nim(72, 17) Error: undeclared identifier: 'gdImageStruct'
    gdfull.nim(116, 53) Error: undeclared identifier: 'va_list'
    gdfull.nim(136, 37) Error: undeclared identifier: 'gdIOCtxPtr'
    gdfull.nim(142, 44) Error: undeclared identifier: 'gdIOCtx'
    
    
    Run

At least most of the hard work is done by the tools. You can mix and match and 
get it working.

Reply via email to