[Mono-list] mono wrappers

Guenther Roith groith@tcrz.net
Sun, 7 Apr 2002 12:46:05 +0200


This is a multi-part message in MIME format.

------=_NextPart_000_0009_01C1DE32.2E688F60
Content-Type: text/plain;
	charset="iso-8859-1"
Content-Transfer-Encoding: 7bit

Greg yesterday sent me two c-wrappers for mono and mcs to replace the
bat-solution I use in mono_setup (and I'm sure you use .bats, too for
calling mcs.exe)

They only work if mcs.exe and mint.exe are in c:\mono-0.10\instal\bin and
the libs in c:\mono-0.10\instal\lib (but you can change that in the source)
and renamed to monomcs.exe and monomint.exe (to avoid confusion).

They work on win 98, however they don't do on win 2k:

mcs.exe works, but behaves a bit strange (e.g. it's required to press ENTER
before it quits, if I run it from the shell)

mint.exe does completely not work on win 2k.

Has anybody a solution? I've attached the programs.

------=_NextPart_000_0009_01C1DE32.2E688F60
Content-Type: application/octet-stream;
	name="mint.c"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
	filename="mint.c"

/*
 * mint wrapper for windows
 * 
 * 4/6/2002 Greg Haerr
 */
#include <stdio.h>
#include <stdlib.h>

#define PROGRAM	"monomint.exe"
#define PATH	"c:\\mono-0.10\\install\\bin"
#define LIB		"c:\\mono-0.10\\install\\lib"

int
main(int ac, char **av)
{
	char *p;
	char newpath[256];

	/* set PATH=*/
	if ((p = getenv("PATH")) == NULL)
		p = "";
	sprintf(newpath, "PATH=%s;%s;%s", PATH, LIB, p);
	putenv(newpath);

	/* run "[path]monomint [args]"*/
	sprintf(newpath, "%s\\%s", PATH, PROGRAM);
	av[0] = newpath;
	execv(newpath, av);
	printf("Can't find %s\n", newpath);
	exit(1);
}

------=_NextPart_000_0009_01C1DE32.2E688F60
Content-Type: application/octet-stream;
	name="mcs.c"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
	filename="mcs.c"

/*
 * mcs wrapper for windows
 * 
 * 4/6/2002 Greg Haerr
 */
#include <stdio.h>
#include <stdlib.h>

#define MINT	"monomint.exe"
#define MCS		"monomcs.exe"
#define PATH	"c:\\mono-0.10\\install\\bin"
#define LIB		"c:\\mono-0.10\\install\\lib"

int
main(int ac, char **av)
{
	char *p;
	char **newav;
	int  i;
	char newpath[256];
	char mcspath[256];

	/* set PATH=*/
	if ((p = getenv("PATH")) == NULL)
		p = "";
	sprintf(newpath, "PATH=%s;%s;%s", PATH, LIB, p);
	putenv(newpath);

	/* copy args up one*/
	newav = malloc((ac+1)*sizeof(char **));
	if (!newav) {
		printf("No mem for args\n");
		exit(1);
	}
	for(i=ac+1; i>0; --i)
		newav[i] = av[i-1];

	/* run "[path]monomint [path]monomcs.exe [args]*/
	sprintf(newpath, "%s\\%s", PATH, MINT);
	newav[0] = newpath;
	sprintf(mcspath, "%s\\%s", PATH, MCS);
	newav[1] = mcspath;
	execv(newpath, newav);
	printf("Can't find %s\n", newpath);
	exit(1);
}

------=_NextPart_000_0009_01C1DE32.2E688F60--