[m-rev.] for review: update README.DotNet
Tyson Dowd
trd at cs.mu.OZ.AU
Fri Aug 3 23:31:16 AEST 2001
Hi,
As things improve, this file gets shorter.
===================================================================
Estimated hours taken: 0.5
Branches: main
README.DotNet:
Update the documentation to reflect all the recent progress on
the .NET backend.
- Use C# as the example interfacing language
- Remove all the nasty build commands that are now automated
Index: README.DotNet
===================================================================
RCS file: /home/mercury1/repository/mercury/README.DotNet,v
retrieving revision 1.4
diff -u -r1.4 README.DotNet
--- README.DotNet 2001/07/09 13:30:44 1.4
+++ README.DotNet 2001/08/03 13:27:53
@@ -70,40 +70,27 @@
To run a Mercury program using the ilc grade, you need to build the
library and runtime in the ilc grade, using the Mercury source distribution.
-After unpacking the Mercury source distribution, run the following commands in
-a Cygwin shell:
+The easiest way to do this is to simply run
+ mmake install LIBGRADES=ilc
- cd mercury
- autoconf
- ./configure
- cd runtime
- MMAKE_DIR=../scripts mmake GRADE=ilc
- cd ..
- cp runtime/*.dll library
- cd library
- mmake depend
- MMAKE_DIR=../scripts mmake GRADE=ilc
- gacutil -i mercury.dll
- cd ..
-
You can now build programs such as hello.m or eliza.m in the samples
directory.
cd samples
- mmake hello.depend
- mmake hello.il
- ilasm hello.il
+ mmake hello.depend GRADE=ilc
+ mmake hello GRADE=ilc
+
+You can also set the grade in an Mmakefile by adding the line
+ GRADE=ilc
-or for single file programs, simply:
+For for single file programs, try:
mmc --grade ilc hello.m
-Now you can finally run hello
+Now you can run hello
./hello.exe
-We expect to automate or eliminate most of these steps in the future.
-
-----------------------------------------------------------------------------
USING DOTNET
@@ -114,47 +101,38 @@
function".
If you find missing functionality, you can interface to the .NET
-Frameworks using the Managed extensions for C++, and Mercury's foreign
-language interface.
+Frameworks using C# and Mercury's foreign language interface.
For example:
-:- pragma foreign_code("MC++", io__getenv(Var::in, Value::out),
- [will_not_call_mercury],
+:- pred to_string(T::in, string::out) is det.
+:- pragma foreign_proc("C#", to_string(T::in, Str::out), [],
"{
- Value = System::Environment::GetEnvironmentVariable(Var);
- SUCCESS_INDICATOR = (Value != 0);
+ Str = T.ToString();
}").
-The implementation will put this Managed C++ code into a separate file,
-which can be compiled with Microsoft's VC++.NET. You will need to make
-sure it is compiled into a dll by running
- mmake <modulename>.il
- ilasm <modulename>.il
- mmake <modulename>__c_code.dll
-Once again, we expect to add automatic dependency generation in future,
-so this step will be done for you.
+The implementation will put this C# in a separate file, which will be
+compiled with Microsoft's C# compiler. mmake will automatically
+generate dependencies for this file and invoke the C# compiler with the
+appropriate options.
-If you add MC++ code to the Mercury standard library, the library/Mmakefile
-will take care of this step when you run `mmake GRADE=ilc'.
-
-You can also use the MC++ interface to interface with any .NET language
+You can also use the C# interface to interface with any .NET language
(Implementations have been announced or are under development for
C++, C#, Visual Basic, Cobol, Eiffel, SmallTalk, ML, Haskell, Scheme,
Python, Perl, Component Pascal and others).
-
-Add a
-:- pragma foreign_header("MC++", "
- #using ""foreignmodulename.dll""
-").
-
-and you can use a .dll that contains .NET code for any other language to
-implement Mercury predicates. You can use the tool `ildasm' to look at
-the contents of a DLL.
+Add a
+ MS_CSCFLAGS-modulename_csharp_code=/reference:foreignmodulename.dll
+or
+ MS_CSCFLAGS-modulename_csharp_code=/addmodule:foreignmodulename.dll
+
+to you Mmmakefile to pass the appropriate flag to the C# compiler so
+that you can reference another DLL from the C# code.
+modulename is the name of your Mercury module, and foreignmodulename is
+the name of the dll you want to use from Mercury via C#.
-We plan to offer a tool that automatically generates a Mercury interface
-for any .NET component in the future.
+We are working on a tool that automatically generates a Mercury interface
+for any .NET component, but it is not yet ready for public use.
-----------------------------------------------------------------------------
--
Tyson Dowd #
# Surreal humour isn't everyone's cup of fur.
trd at cs.mu.oz.au #
http://www.cs.mu.oz.au/~trd #
--------------------------------------------------------------------------
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