[GRASS5] Swig interface for Grass
Glynn Clements
glynn at gclements.plus.com
Tue Aug 30 18:28:20 EDT 2005
Ari Jolma wrote:
> [note: this discussion got initiated outside this list]
>
> Markus Neteler wrote:
>
> >One example as "seed" may be sufficient to get other people
> >interested, something like a proof of concept. This may break
> >the barrier to do more python and perl with GRASS.
> >
> >
>
> Well, I managed to get a Grass error message from a Perl program :)
>
> I made a simple Swig interface file into which I added the main() from
> r.slope.aspect with a new name:
>
> int r_slope_aspect (int argc, char **argv);
>
> With this I get the wrapper code and the Grass Perl module. Then I made
> a simple Makefile.PL for the Perl extension, which lists the shared
> grass libs and object code files from the wrapper and the
> r_slope_aspect. Makefile.PL is standard, after running it gives
> Makefile, which is for making the necessary binaries for the Grass
> module and installing the module etc. I put into the test code a
> function call:
>
> Grass::r_slope_aspect(1,['abc']);
>
> which gives me the Grass error "ERROR: LOCATION_NAME not set"
>
> I have a Grass database and I get the same error running r.slope.aspect.
Are you running this from within a GRASS session? The GRASS libraries
require a number of environment variables to be set.
--
Glynn Clements <glynn at gclements.plus.com>
More information about the grass-dev
mailing list