digitalmars.D.announce - D bindings for Shapefile C Library
- Craig Dillabaugh (12/12) Jan 28 2014 I've created bindings for the C Shapefile Library. Shapefiles
- Rikki Cattermole (4/20) Jan 28 2014 For simple static bindings, it looks fine. You'll probably have
- evilrat (5/7) Jan 28 2014 what fun? using (coff)implib once? come on, that's not that hard
- Rikki Cattermole (3/12) Jan 29 2014 I'm just referring to it being messier than it needs to be. This
- Suliman (3/3) Jan 28 2014 Big thanks! Could you provide simple example of usage this lib. I
- Craig Dillabaugh (2/7) Jan 29 2014 I will see if I can add something to the readme file.
- Craig Dillabaugh (22/27) Jan 29 2014 Not sure what sort of help you need, and what platform?
- =?UTF-8?B?U8O2bmtlIEx1ZHdpZw==?= (14/26) Jan 29 2014 There are only two possible improvements that I can see:
- Gary Willoughby (11/27) Jan 29 2014 This is how i'm doing it:
- Craig Dillabaugh (5/35) Jan 29 2014 Thanks. I've had a few requests to generate .lib files so I will
- Gary Willoughby (28/28) Jan 29 2014 A few things i tend to do when porting headers:
- Craig Dillabaugh (3/31) Jan 29 2014 Thanks very much.
I've created bindings for the C Shapefile Library. Shapefiles are a format used commonly in vector based Geographic Information Systems, often for data interchange. It is a pretty simple library and it is my first effort at creating such bindings. https://github.com/craig-dillabaugh/shplib.d I've looked in Demios and code.dlang.org to see what the standard setup for such bindings is, and while most are similar there doesn't seem to be an accepted layout. If anyone has a moment to spare I would be happy if someone could have a look to see if there are any obvious improvements that should be made. I plan to run a few more tests on my bindings, and once those all work, I hope to add this to code.dlang.org.
Jan 28 2014
On Wednesday, 29 January 2014 at 04:24:36 UTC, Craig Dillabaugh wrote:I've created bindings for the C Shapefile Library. Shapefiles are a format used commonly in vector based Geographic Information Systems, often for data interchange. It is a pretty simple library and it is my first effort at creating such bindings. https://github.com/craig-dillabaugh/shplib.d I've looked in Demios and code.dlang.org to see what the standard setup for such bindings is, and while most are similar there doesn't seem to be an accepted layout. If anyone has a moment to spare I would be happy if someone could have a look to see if there are any obvious improvements that should be made. I plan to run a few more tests on my bindings, and once those all work, I hope to add this to code.dlang.org.For simple static bindings, it looks fine. You'll probably have fun getting it to work on Windows 32 bit though. Thank you OMF.
Jan 28 2014
On Wednesday, 29 January 2014 at 05:12:45 UTC, Rikki Cattermole wrote:For simple static bindings, it looks fine. You'll probably have fun getting it to work on Windows 32 bit though. Thank you OMF.what fun? using (coff)implib once? come on, that's not that hard at all... the only "fun" is when lib export only constants which is rare.
Jan 28 2014
On Wednesday, 29 January 2014 at 06:55:17 UTC, evilrat wrote:On Wednesday, 29 January 2014 at 05:12:45 UTC, Rikki Cattermole wrote:I'm just referring to it being messier than it needs to be. This is a little pet peeve of mine.For simple static bindings, it looks fine. You'll probably have fun getting it to work on Windows 32 bit though. Thank you OMF.what fun? using (coff)implib once? come on, that's not that hard at all... the only "fun" is when lib export only constants which is rare.
Jan 29 2014
Big thanks! Could you provide simple example of usage this lib. I have not experience in usage bindings, but I would like to try to write some tiny app to working with shp files.
Jan 28 2014
On Wednesday, 29 January 2014 at 05:26:31 UTC, Suliman wrote:Big thanks! Could you provide simple example of usage this lib. I have not experience in usage bindings, but I would like to try to write some tiny app to working with shp files.I will see if I can add something to the readme file.
Jan 29 2014
On Wednesday, 29 January 2014 at 05:26:31 UTC, Suliman wrote:Big thanks! Could you provide simple example of usage this lib. I have not experience in usage bindings, but I would like to try to write some tiny app to working with shp files.Not sure what sort of help you need, and what platform? First thing I would suggest though is to get your hands on some Shapefile data. You can get some free stuff here (there is lots of free Shapefile data floating around out there): http://download.geofabrik.de/ Note that a Shapefile is actually a collection of files (.shp, .shx, .dbf, .prj) sharing the same base name. You need all the files in the same location and then if you access 'building' the library will need the files building.shp, building.shx, building.dbf (I think the .prj is optional). To actually build The Shapefile library you can download it form here: http://shapelib.maptools.org/ I build an static library on linux ( libshp.a ) and then, because I was lazy and libshp is small I just copied that into my test directory and built a test program with the following command: dmd -gc shapetest.d shapefil.d libshp.a Where shapetest.d is my test program, shapefil.d is my binding, and libshp.a is the library. My shapetest.d is currently a bit of a mess, but I can put it on gitHub in a day or two if you would like.
Jan 29 2014
Am 29.01.2014 05:24, schrieb Craig Dillabaugh:I've created bindings for the C Shapefile Library. Shapefiles are a format used commonly in vector based Geographic Information Systems, often for data interchange. It is a pretty simple library and it is my first effort at creating such bindings. https://github.com/craig-dillabaugh/shplib.d I've looked in Demios and code.dlang.org to see what the standard setup for such bindings is, and while most are similar there doesn't seem to be an accepted layout. If anyone has a moment to spare I would be happy if someone could have a look to see if there are any obvious improvements that should be made. I plan to run a few more tests on my bindings, and once those all work, I hope to add this to code.dlang.org.There are only two possible improvements that I can see: - The "C" folder may be better off in the root folder of the project, because it doesn't fit with the D sources from a build process point of view. In practice it doesn't really hurt either, so your mileage may vary. - Usually I try to include .lib files for the library bindings on Windows, since it greatly simplifies the setup process, which is usually trivial on Linux. Other than that I'd recommend to use a version scheme for the git tags/branches that matches the version scheme of the C library (probably excluding the patch version, which should be reserved for the binding itself). Unfortunately the Deimos bindings use neither branches, nor version tags.
Jan 29 2014
On Wednesday, 29 January 2014 at 04:24:36 UTC, Craig Dillabaugh wrote:I've created bindings for the C Shapefile Library. Shapefiles are a format used commonly in vector based Geographic Information Systems, often for data interchange. It is a pretty simple library and it is my first effort at creating such bindings. https://github.com/craig-dillabaugh/shplib.d I've looked in Demios and code.dlang.org to see what the standard setup for such bindings is, and while most are similar there doesn't seem to be an accepted layout. If anyone has a moment to spare I would be happy if someone could have a look to see if there are any obvious improvements that should be made. I plan to run a few more tests on my bindings, and once those all work, I hope to add this to code.dlang.org.This is how i'm doing it: https://github.com/nomad-software/tcltk This is a binding for Tcl/Tk libs. I've included windows dll import libraries in various formats (for different environments and compilers) to make the build process easier. I've also kept the c headers in the source folder but excluded them in the package.json file (just in case). I've added one version (the same as the c sources) for when the bindings supported an older version but the latest version is in master.
Jan 29 2014
On Wednesday, 29 January 2014 at 14:09:20 UTC, Gary Willoughby wrote:On Wednesday, 29 January 2014 at 04:24:36 UTC, Craig Dillabaugh wrote:Thanks. I've had a few requests to generate .lib files so I will see about that. I don't do very much development on Windows, but this should be good practice for me.I've created bindings for the C Shapefile Library. Shapefiles are a format used commonly in vector based Geographic Information Systems, often for data interchange. It is a pretty simple library and it is my first effort at creating such bindings. https://github.com/craig-dillabaugh/shplib.d I've looked in Demios and code.dlang.org to see what the standard setup for such bindings is, and while most are similar there doesn't seem to be an accepted layout. If anyone has a moment to spare I would be happy if someone could have a look to see if there are any obvious improvements that should be made. I plan to run a few more tests on my bindings, and once those all work, I hope to add this to code.dlang.org.This is how i'm doing it: https://github.com/nomad-software/tcltk This is a binding for Tcl/Tk libs. I've included windows dll import libraries in various formats (for different environments and compilers) to make the build process easier. I've also kept the c headers in the source folder but excluded them in the package.json file (just in case). I've added one version (the same as the c sources) for when the bindings supported an older version but the latest version is in master.
Jan 29 2014
A few things i tend to do when porting headers: 1). https://github.com/craig-dillabaugh/shplib.d/blob/master/source/shapefil.d#L267 'const char *filename' should usually be translated to 'const(char)* filename', 'const double * padfX' => 'const(double)* padfX' etc.. Reference: http://forum.dlang.org/thread/qvjjzoxoufxnxzokywgq forum.dlang.org 2). https://github.com/craig-dillabaugh/shplib.d/blob/master/source/shapefil.d#L275 Underscores on identifiers that match keywords are usually added to the end. Reference: http://dlang.org/dstyle.html 3). https://github.com/craig-dillabaugh/shplib.d/blob/master/source/shapefil.d#L263 longs/ulongs tend to be substituted for c_long/c_ulong from core.stdc.config. Reference: http://dlang.org/interfaceToC.html 4). https://github.com/craig-dillabaugh/shplib.d/blob/master/source/shapefil.d#L721 I tend to add const to all char* types as above. In general, add 'nothrow' to all functions and move the '*' to be part of the type. e.g.: 'const(char)* text' instead of 'const(char) *text', this is my own personal preference though. :p
Jan 29 2014
On Wednesday, 29 January 2014 at 14:34:56 UTC, Gary Willoughby wrote:A few things i tend to do when porting headers: 1). https://github.com/craig-dillabaugh/shplib.d/blob/master/source/shapefil.d#L267 'const char *filename' should usually be translated to 'const(char)* filename', 'const double * padfX' => 'const(double)* padfX' etc.. Reference: http://forum.dlang.org/thread/qvjjzoxoufxnxzokywgq forum.dlang.org 2). https://github.com/craig-dillabaugh/shplib.d/blob/master/source/shapefil.d#L275 Underscores on identifiers that match keywords are usually added to the end. Reference: http://dlang.org/dstyle.html 3). https://github.com/craig-dillabaugh/shplib.d/blob/master/source/shapefil.d#L263 longs/ulongs tend to be substituted for c_long/c_ulong from core.stdc.config. Reference: http://dlang.org/interfaceToC.html 4). https://github.com/craig-dillabaugh/shplib.d/blob/master/source/shapefil.d#L721 I tend to add const to all char* types as above. In general, add 'nothrow' to all functions and move the '*' to be part of the type. e.g.: 'const(char)* text' instead of 'const(char) *text', this is my own personal preference though. :pThanks very much.
Jan 29 2014