From: "Marin David Condic" <marin.condic.auntie.spam@pacemicro.com>
Subject: Re: Using Windows GNAT with Cygwin
Date: Tue, 15 May 2001 17:24:17 -0400
Date: 2001-05-15T21:24:19+00:00 [thread overview]
Message-ID: <9ds6q3$po9$1@nh.pace.co.uk> (raw)
In-Reply-To: u3da6nx40.fsf@gsfc.nasa.gov
Having just gone through this, here's another little bit of help: The
following C program was written by Sune Falck to change the registry entries
& can readily be run in an initialization .BAT file. I tweaked the program
ever so slightly from its original design so it may not bit-for-bit match
with the original if you got it from another source.
MDC
/*
* File: select_gcc.c
*
* Author: Sune Falck
*
* Purpose: To allow egcs and gnat to coexist by changing the value
* GCC under the key LOCAL_MACHINE\Software\Free Software
Foundation
* to the installation directory for gnat or egcs.
* The installation directories must be manually set up with
* REGEDIT in the values GCC_GNAT and GCC_EGCS under the same key.
*
* Syntax: select_gcc gnat|egcs
*
* Date: 1999-01-26
*
* Changes: 1999-01-27 Sune Falck
* Changed protection in RegOpenKeyEx because of ACCESS DENIED
* error when running under Windows NT
*
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
void Test_For_Error (int Error, char *Error_Text);
int main (int argc, char **argv)
{
LONG rc; /* Return code */
HKEY Key; /* Key handle */
char *Prefix = "GCC_";
char Name [256]; /* Constructed key name */
char Value [256];
DWORD Value_Type;
DWORD Value_Length;
fprintf (stderr, "\n\n argv[0] %s argv[1] %s\n\n", argv[0], argv[1]);
Test_For_Error (argc != 2, "-I-No parameter given.");
/* Create a value name from GCC_ and the command parameter */
strcpy (Name, Prefix);
strcat (Name, argv [1]);
Value_Length = sizeof (Value);
rc = RegOpenKeyEx (HKEY_LOCAL_MACHINE, "Software\\Free Software
Foundation",
0, KEY_READ|KEY_SET_VALUE, &Key);
Test_For_Error (rc != ERROR_SUCCESS, "-E-Can't open registry key "
"\"HKLM\\Software\\Free Software Foundation\".");
rc = RegQueryValueEx (Key, Name, 0, &Value_Type, Value, &Value_Length);
Test_For_Error (rc != ERROR_SUCCESS,
"-E-No saved value GCC_XXXX for given configuration.");
rc = RegSetValueEx (Key, "GCC", 0, Value_Type, Value, Value_Length);
Test_For_Error (rc != ERROR_SUCCESS,
"-E-New value for GCC could not be stored.");
RegCloseKey (Key);
return EXIT_SUCCESS;
}
void Test_For_Error (int Error, char *Error_Text)
{
if (Error) {
fprintf (stderr, "select_gcc%s\n\n", Error_Text);
fprintf
(stderr,
"Switch between gnat and egcs by modifying registry\n\n"
"Manually set up the values GCC_GNAT and GCC_EGCS to the\n"
"installation directories for gnat and egcs with REGEDIT\n"
"for the key LOCAL_MACHINE\\Software\\Free Software Foundation.\n"
"Use select_gcc with gnat or egcs as parameter to switch\n"
"between the compilers - the path must also be adjusted.\n");
exit (EXIT_FAILURE);
}
}
--
Marin David Condic
Senior Software Engineer
Pace Micro Technology Americas www.pacemicro.com
Enabling the digital revolution
e-Mail: marin.condic@pacemicro.com
Web: http://www.mcondic.com/
"Stephen Leake" <stephen.a.leake.1@gsfc.nasa.gov> wrote in message
news:u3da6nx40.fsf@gsfc.nasa.gov...
> Set PATH appropriately. There is also one registry setting that Cygwin
> and GNAT fight over;
>
> HKEY_LOCAL_MACHINE\SOFTWARE\Free Software Foundation
>
> The simplest way to manage this is to use the Registry Editor to
> export this key (to a .reg file) after installing Cygwin, and again
> after installing GNAT. Then run the appropriate .reg file when you
> need to run the compiler.
>
> This use of the registry is totally inappropriate, as far as I can
> tell. It just gets in the way.
>
> You can set PATH and run the .reg file from a batch script; that
> simplifies things a bit.
>
> --
> -- Stephe
next prev parent reply other threads:[~2001-05-15 21:24 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <2m53gtkmvaou7ktac1jfmfmb32iuiernkm@4ax.com>
2001-05-15 21:03 ` Using Windows GNAT with Cygwin Stephen Leake
2001-05-15 21:24 ` Marin David Condic [this message]
[not found] ` <hgq3gt8mch5qsmieckv2hkolo3ohbmf64e@4ax.com>
2001-05-16 19:41 ` Stephen Leake
2001-05-16 19:51 ` Ed Falis
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox