[GRASS-dev] Call Grass modules from C++ code

matteo poletti pollo1_91 at yahoo.it
Mon Feb 18 05:31:06 PST 2013


Hi,

I've already posted this question in the User mailing list but maybe, as suggested by somebody, it should be posted here...

The problem is how to call a Grass module from my code written in C++.

I have already received some answers:

1 - Do a sys-call

I would avoid this approach if possible. It is not very reliable and it requires to parse the output of the modules as strings.

2 - Use the keyword extern to call the GRASS library functionalities (http://grasswiki.osgeo.org/wiki/GRASS_and_C++)

I have not understood if this approach is suitable also to call GRASS modules. If it is, can you please suggest me an example of this?

Thank you for your help! And sorry for having posted this twice.
Matteo



More information about the grass-dev mailing list