[GRASS5] Libgrass_gis on Mingw - open.c patch

Glynn Clements glynn at gclements.plus.com
Fri May 20 17:48:47 EDT 2005


Javier A. Yebrin wrote:

> I'll send the build errors as soon I get my work organized. I've started
> with some real testing and recompilation. The current module undergoing this
> test is r.average, which is presenting some problems because of system calls
> to r.stats and r.recode.

Does the Windows runtime not support system(), or is r.average using
Unix-specific features?

> I'm thinking of writing the r.stats/recode modules as functions inside
> r.average. Do you think this is feasable?

Not in all cases. GRASS modules need to be able to execute other
programs.

I have written some replacements for system() in lib/gis/spawn.c.
However, these haven't been tested yet, and are currently only
implemented for Unix.

Ultimately, all calls to system() should be replaced with an interface
which can reasonably be implemented on all common platforms. For
Windows, this would involve CreateProcess() (or possibly _spawnl(), as
is used in G_system() in lib/gis/system.c).

Even on Unix, system() isn't a particularly robust mechanism for
invoking other programs. Primarily because it uses the shell, which
performs complex translations on the argument.

-- 
Glynn Clements <glynn at gclements.plus.com>




More information about the grass-dev mailing list