Define ctypes structures, argtypes and restypes; fix for redmine issue #9105

Tested on Mac 10.7 and 10.9. Not sure what the `lwgeom_buildarea` function does, but the `lwgeom_make_valid` function corrects geometry.

[My test script and shapefile with invalid geometry (bow tie)](http://drive.dakotacarto.com/qgis/liblwgeom_issue9105_test.zip). You can use the [Plain Geometry Editor](http://plugins.qgis.org/plugins/plaingeometryeditor/) plugin to paste test results, but I could only get the plugin's paste function to work with the WKT option.