Files
mercury/tests/hard_coded/export_test.m
Fergus Henderson 47a19fda80 Fix a bug: the `pragma c_code' declaration did not specify
Estimated hours taken: 2

tests/hard_coded/export.m:
	Fix a bug: the `pragma c_code' declaration did not specify
	`may_call_mercury' even though the C code actually did call Mercury.
	This caused it to break when compiled with `-O1' in grade `jump'.
1997-09-11 02:11:56 +00:00

32 lines
498 B
Mathematica

%
% test case for calling an exported Mercury proc from pragma c_code.
%
% author: dgj
:- module export_test.
:- interface.
:- import_module int, io.
:- pred main(io__state::di, io__state::uo) is det.
:- pred foo(int::in, int::out) is det.
:- pred bar(int::in, int::out) is det.
:- implementation.
main -->
{ bar(41, X) },
io__write(X),
io__write_char('\n').
foo(X, X+1).
:- pragma export(foo(in, out), "foo").
:- pragma c_code(bar(X::in, Y::out), may_call_mercury,
"
foo(X, &Y);
").