[m-rev.] for review: implement pragma foreign_export
Julien Fischer
juliensf at csse.unimelb.edu.au
Wed Jul 19 16:57:01 AEST 2006
On Wed, 19 Jul 2006, Ian MacLarty wrote:
>>>>>> Index: doc/reference_manual.texi
>>>>>> ===================================================================
>>>>>> RCS file: /home/mercury1/repository/mercury/doc/reference_manual.texi,v
>>>>>> retrieving revision 1.357
>>>>>> diff -u -r1.357 reference_manual.texi
>>>>>> --- doc/reference_manual.texi 5 Jul 2006 08:45:37 -0000 1.357
>>>>>> +++ doc/reference_manual.texi 12 Jul 2006 08:05:27 -0000
>>>>>> @@ -6071,6 +6071,9 @@
>>>>>> or function as a call to code
>>>>>> written in a different
>>>>>> programming language.
>>>>>> +* Calling Mercury from foreign code:: How to call a Mercury predicate
>>>>>> + or funciton from a different
>>>>>> + programming language.
>>>>>> * Using foreign types from Mercury:: How to use a type defined in
>>>>>> a different programming language
>>>>>> in Mercury code.
>>>>>> @@ -6388,6 +6391,41 @@
>>>>>>
>>>>>> @c
>>>>>> -----------------------------------------------------------------------
>>>>>>
>>>>>> + at node Calling Mercury from foreign code
>>>>>> + at section Calling Mercury from foreign code
>>>>>> +
>>>>>> +Mercury procedures may be exported so that they can be called by code
>>>>>> written
>>>>>> +in a foreign language.
>>>>>> +
>>>>>
>>>>> I think you need to clarify that the foreign code that calls the Mercury
>>>>> code must in turn have been called from Mercury code, or alternatively
>>>>> the user needs to take steps to initialize the Mercury runtime before
>>>>> calling the exported procedure.
>>>>
>>>> Yes, but I'm not going to do that as a part of this diff. Currently
>>>> the only documentation we can point a user to for doing that is the
>>>> code in samples. I'm planning to write a new section for the user's
>>>> guide on initialising the runtime as part of the standalone libraries
>>>> change - I'll update this section then.
>>>>
>>>
>>> I still think it at least say that calling exported Mercury procedures
>>> from foreign code that's not called from Mercury code originally is not
>>> yet supported. Reading the doc I'd expect to be able to call the
>>> exported proc from my C program, but that won't work at the moment.
>>
>> Yes it will. See samples/c_interface/simpler_c_calls_mercury.
>>
>
> Oh, okay. I thought there was a problem because the runtime needs
> initializing, but if it works then okay.
>
Yes, the runtime does need to be initialised. The example in samples
directory shows you how to do that. The mechanism I've been working
on for standalone libraries provides another. I agree the we require
better documentation for it (also working on that).
I think that the documentation about initialising the runtime etc, belongs
in the user's guide. When it exists I'll add a pointer to it from here.
Julien.
--------------------------------------------------------------------------
mercury-reviews mailing list
post: mercury-reviews at csse.unimelb.edu.au
administrative address: owner-mercury-reviews at csse.unimelb.edu.au
unsubscribe: Address: mercury-reviews-request at csse.unimelb.edu.au Message: unsubscribe
subscribe: Address: mercury-reviews-request at csse.unimelb.edu.au Message: subscribe
--------------------------------------------------------------------------
More information about the reviews
mailing list