[mercury-users] IL foreign code not working

Jonathan Morgan jonmmorgan at gmail.com
Tue Apr 18 17:01:10 AEST 2006


mmc --make does not seem to work properly with foreign code in the IL
grade.  mmake isn't that much better.  Circular dependencies are
generated between the C#/MC++ DLLs and the basic IL DLL, which are
dropped by mmake, while mmc --make produces error messages like the
following.

Error: circular dependency detected while building
  `iltest__csharp_code.dll'.
  This is due to a forbidden foreign_import_module cycle.
** Nothing to be done for `iltest.exe'.

The program that generates this is about the simplest foreign proc you
could get:

:- module iltest.
:- interface.
:- import_module io.
:- pred main(io::di, io::uo) is det.
:- implementation.

main(!IO) :- my_write("Hello, world.", !IO).

:- pred my_write(string::in, io::di, io::uo) is det.
:- pragma foreign_proc("C#",
	my_write(Str::in, _IO0::di, _IO::uo),
	[will_not_call_mercury, promise_pure],
"
	System.Console.WriteLine(Str);
").

The equivalent MC++ foreign_proc causes the same results:

Error: circular dependency detected while building
  `iltest__cpp_code.dll'.
  This is due to a forbidden foreign_import_module cycle.
** Nothing to be done for `iltest.exe'.

It also seems that the DLLs are built by mmake to reference
themselves, which doesn't work (as the DLL doesn't exist) and also to
reference each other in a way that doesn't work.  This happens with
mercury-0.12.2, as well as with recent rotds.

Any reason why this is the case?  What (if anything) can be done to
fix it?  The work-around is to use mmake -s and hand edit the
Makefiles to remove some of the DLL dependencies, but it's not
portable, and it's also quite messy.

Jon

--------------------------------------------------------------------------
mercury-users mailing list
post:  mercury-users at cs.mu.oz.au
administrative address: owner-mercury-users at cs.mu.oz.au
unsubscribe: Address: mercury-users-request at cs.mu.oz.au Message: unsubscribe
subscribe:   Address: mercury-users-request at cs.mu.oz.au Message: subscribe
--------------------------------------------------------------------------



More information about the users mailing list