[m-rev.] diff: implement io__set_environment_variable for .NET
Peter Ross
pro at missioncriticalit.com
Tue Nov 5 20:51:12 AEDT 2002
On Mon, Nov 04, 2002 at 11:55:56AM +0100, Peter Ross wrote:
> On Sat, Nov 02, 2002 at 05:07:15PM +1100, Fergus Henderson wrote:
> > library/Mmakefile:
> > A tweak needed to get things to link properly after the above
> > change to io.m.
> >
> I am not so sure about this change, my nightly install of .NET now falls
> over with this error message
>
I have backed out the change to io.m that calls putenv from MC++ because I
cannot get it to work with setup.
Hi,
===================================================================
Estimated hours taken: 0.1
Branches: main
library/io.m:
Backout the implementation of io__putenv in MC++ as it causes
the link error:
LIBCMT.lib(crt0.obj) : error LNK2019: unresolved
external symbol _main referenced in function
_mainCRTStartup
Index: io.m
===================================================================
RCS file: /home/mercury1/repository/mercury/library/io.m,v
retrieving revision 1.274
diff -u -r1.274 io.m
--- io.m 3 Nov 2002 11:20:41 -0000 1.274
+++ io.m 5 Nov 2002 09:48:34 -0000
@@ -5769,26 +5769,31 @@
SUCCESS_INDICATOR = (putenv(VarAndValue) == 0);
").
-:- pragma foreign_proc("MC++", io__putenv(VarAndValue::in),
- [will_not_call_mercury, tabled_for_io],
-"
- /*
- ** Unfortunately there is no API in the .NET standard library
- ** for setting environment variables. So we need to use
- ** platform-specific methods. Currently we use the Posix function
- ** putenv(), which is also supported on Windows.
- */
-
- /*
- ** Convert VarAndValue from a .NET managed string (System.String)
- ** to an unmanaged C string (`char *') on the unmanaged C heap,
- ** and then just invoke putenv().
- */
- char __nogc *c_string = static_cast<char*>(
- System::Runtime::InteropServices::Marshal::
- StringToHGlobalAnsi(VarAndValue).ToPointer());
- SUCCESS_INDICATOR = (putenv(c_string) == 0);
-").
+%
+% XXX Disabled until the following build error is fixed
+% LIBCMT.lib(crt0.obj) : error LNK2019: unresolved external symbol _main
+% referenced in function _mainCRTStartup
+%
+%:- pragma foreign_proc("MC++", io__putenv(VarAndValue::in),
+% [will_not_call_mercury, tabled_for_io],
+%"
+% /*
+% ** Unfortunately there is no API in the .NET standard library
+% ** for setting environment variables. So we need to use
+% ** platform-specific methods. Currently we use the Posix function
+% ** putenv(), which is also supported on Windows.
+% */
+%
+% /*
+% ** Convert VarAndValue from a .NET managed string (System.String)
+% ** to an unmanaged C string (`char *') on the unmanaged C heap,
+% ** and then just invoke putenv().
+% */
+% char __nogc *c_string = static_cast<char*>(
+% System::Runtime::InteropServices::Marshal::
+% StringToHGlobalAnsi(VarAndValue).ToPointer());
+% SUCCESS_INDICATOR = (putenv(c_string) == 0);
+%").
io__putenv(_) :-
% This version is only used for back-ends for which there is no
--------------------------------------------------------------------------
mercury-reviews mailing list
post: mercury-reviews at cs.mu.oz.au
administrative address: owner-mercury-reviews at cs.mu.oz.au
unsubscribe: Address: mercury-reviews-request at cs.mu.oz.au Message: unsubscribe
subscribe: Address: mercury-reviews-request at cs.mu.oz.au Message: subscribe
--------------------------------------------------------------------------
More information about the reviews
mailing list