[GRASS-user] Run a GRASS module from a custom module (C language)

José María Michia Roberts jose.maria.michia at gmail.com
Mon Feb 25 23:23:30 PST 2013


2013/2/22 Rainer M Krug <r.m.krug en gmail.com>:
> Please check out the thread "Call Grass modules from C++ code"
> (http://article.gmane.org/gmane.comp.gis.grass.user/46272)
>
> I assume it is the same for C

Thanks Rainer.  My apologies for re-post this question. I worked hard
looking for a solution, to avoid writing to the list, yet I missed
that thread. Your response was very helpful in guiding my quest! I
learned about the functions "system, fork, exec and popen" among other
things.

2013/2/25 Vaclav Petras <wenzeslaus en gmail.com>:
> Hi, maybe you already did, [...]

I'm still learning! I have found that a simple call to function
"system()"  is enough. But I was curious to learn how to use "fork /
exec", and was a bit difficult for me.

> [...] but note that you can profile you Python
> script to find the time consuming places (before rewriting all in C).
>
> How to use Python profiler for GRASS Python script and visualize the
> result is described here:
>
> http://grasswiki.osgeo.org/wiki/Tools_for_Python_programming#cProfile
>
> Feel free to edit or ask if the page is not complete.

Very interesting, I'll try.

Anyway, I'm very excited to learn C, so I'll probably solve the
problem using both languages.

Thank you all!
Salud!
José María


More information about the grass-user mailing list