-
Notifications
You must be signed in to change notification settings - Fork 56
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add short example of Java interface.
samples/java_interface/short_example.m: A Java version of the short example. samples/java_interface/README.md: Add an entry for the new example. samples/c_interface/README.md: samples/csharp_interface/README.md: Fix wording.
- Loading branch information
Showing
4 changed files
with
28 additions
and
2 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
% This is a simple example of using the foreign language interface to call the | ||
% Java method System.out.println(). | ||
|
||
% This source file is hereby placed in the public domain. | ||
|
||
:- module short_example. | ||
:- interface. | ||
:- import_module io. | ||
|
||
:- pred main(io::di, io::uo) is det. | ||
|
||
:- implementation. | ||
|
||
main(!IO) :- | ||
java_write_line("Hello, world", !IO). | ||
|
||
:- pred java_write_line(string::in, io::di, io::uo) is det. | ||
:- pragma foreign_proc("JAva", | ||
java_write_line(S::in, _IO0::di, _IO::uo), | ||
[promise_pure, will_not_call_mercury], | ||
" | ||
System.out.println(S); | ||
"). |