Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make it possible to install and use the csharp.ssdebug grade.
Branches: main Make it possible to install and use the csharp.ssdebug grade. Mmake.workspace: Never try to link with `mer_rt' in C# grades. browser/Mmakefile: mdbcomp/Mmakefile: ssdb/Mmakefile: Use `mmc --make' to install these libraries in `csharp' grades. Don't add C libraries to MLLIBS in non-C or asm grades. browser/Mercury.options: ssdb/Mercury.options: "EXTRA_LIBRARIES-libname" doesn't actually work with `mmc --make', but "LIBRARIES-name" does. library/exception.m: ssdb/ssdb.m: Handle EXCP events in C# grades. Trap SIGINT when running ssdb in C# grades. Add `exit_process' implementation. browser/declarative_execution.m: browser/listing.m: Add stubs for C#. README.CSharp: Document the C# backend. README.DotNet: Add a pointer to README.CSharp. README.Erlang: README.Java: Remove a non-sensical paragraph. .INSTALL.in: configure.in: Add `--enable-csharp-grade' option. Make `configure --enable-ssdebug-grades' add `csharp.ssdebug' to the list of library grades.
- Loading branch information
Showing
17 changed files
with
279 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -34,3 +34,4 @@ README.MS-Windows | |
README.OSF1 | ||
README.Solaris | ||
README.ssdebug | ||
README.CSharp |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,124 @@ | ||
----------------------------------------------------------------------------- | ||
|
||
INTRODUCTION | ||
|
||
This release of Mercury contains a port to the ECMA Common Language | ||
Infrastructure (CLI), i.e. Microsoft .NET or Mono. The Mercury | ||
compiler will generate C# source code that can be compiled into | ||
bytecode suitable for running on the .NET or Mono runtime systems. | ||
|
||
The port is mostly complete, but some parts of the Mercury standard | ||
library are not yet implemented (for a full list see the FAQ below). | ||
|
||
The port is currently targeted at C# 2.0 or higher. | ||
|
||
NOTE: a previous backend also targetted the .NET runtime, by generating IL | ||
(Intermediate Language), rather than going via C#. That backend is | ||
out-of-date and may be removed in the future. | ||
|
||
PREREQUISITES | ||
|
||
In order to try this system you will need | ||
|
||
- Either Microsoft.NET or Mono 2.8 or above. | ||
|
||
WARNING | ||
|
||
Please note that the C# backend is still an experimental feature. | ||
|
||
----------------------------------------------------------------------------- | ||
|
||
THE C# GRADE | ||
|
||
The Mercury compiler currently supports the grade `csharp'. | ||
The csharp grade is enabled by using any of the options | ||
`--grade csharp', `--target csharp', or just `--csharp'. | ||
|
||
To run a Mercury program using the csharp grade, you need to build the Mercury | ||
library and runtime in the csharp grade, using the Mercury source distribution. | ||
|
||
You can now build programs such as hello.m or calculator.m in the samples | ||
directory. | ||
|
||
cd samples | ||
mmc --make --csharp hello | ||
|
||
Now you can run hello | ||
|
||
./hello | ||
|
||
----------------------------------------------------------------------------- | ||
|
||
USING C# | ||
|
||
The Mercury standard library has not been fully ported to C# yet. | ||
The use of unimplemented procedures will result in a run-time error, | ||
with a message such as "Sorry, not implemented: foreign code for this | ||
function", and a stack trace. | ||
|
||
If you find missing functionality, you can interface to C# using Mercury's | ||
foreign language interface. | ||
|
||
For example: | ||
|
||
:- pred to_string(T::in, string::out) is det. | ||
:- pragma foreign_proc("C#", to_string(T::in, Str::out), [], | ||
" | ||
Str = T.ToString(); | ||
"). | ||
|
||
The implementation will include this C# code in the module's .cs file, and | ||
you can then call the predicate to_string exactly the same as if it were | ||
implemented using pure Mercury code. | ||
|
||
For more information about the foreign language interface, see the Mercury | ||
Language Reference Manual, which you can find at: | ||
|
||
<http://www.mercury.csse.unimelb.edu.au/information/documentation.html> | ||
|
||
----------------------------------------------------------------------------- | ||
|
||
FREQUENTLY ASKED QUESTIONS (FAQS) | ||
|
||
Q. What are the advantages of using the C# back-end? | ||
|
||
A. The main advantage is easy access to the wide range of libraries for the | ||
.NET platform, and the portability you get from using CIL bytecode. | ||
|
||
|
||
Q. What features are not yet implemented for the C# back-end? | ||
|
||
A. The following implementation features are not supported: | ||
|
||
Mercury-level debugging (but see next question) | ||
Mercury-level profiling | ||
trailing | ||
tabling | ||
|
||
In addition, the following individual procedures are incompletely | ||
implemented: | ||
|
||
io.read_binary/{3,4}: | ||
io.write_binary/{3,4}: | ||
io.read_binary is broken. | ||
|
||
benchmarking.report_stats/0: | ||
benchmarking.report_full_memory_stats/0: | ||
Memory usage statistics are not yet available, and cpu time | ||
is not the same as in the C backends, as per time.m. | ||
|
||
store.arg_ref/5: | ||
store.new_arg_ref/5: | ||
Due to the absence of RTTI, dynamic type checking is missing | ||
for these predicates. They should be used with care. | ||
|
||
This list is not complete. | ||
|
||
|
||
Q. How do I debug Mercury programs on .NET? | ||
|
||
A. The only Mercury-level debugger available for C# grades is the | ||
source-to-source debugger; see README.ssdebug. | ||
|
||
|
||
----------------------------------------------------------------------------- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.