[m-dev.] conditional compilation

Julien Fischer juliensf at csse.unimelb.edu.au
Thu Mar 26 02:50:32 AEDT 2009


On Wed, 25 Mar 2009, Peter Wang wrote:

> 2009/3/25 Julien Fischer <juliensf at csse.unimelb.edu.au>:
>>
>> On Wed, 25 Mar 2009, Peter Wang wrote:
>>>
>>> :- pragma foreign_decl("C", local, "
>>>   static MR_Word known_tests;
>>> ").
>>>
>>> :- pragma foreign_code("C", "
>>>   static MR_Word known_tests = 0; /* relies on representation of map.empty
>>> */
>>> ").
>>
>> You don't want those to be static, if the access preds get opt_exported
>> you will end up with link errors.
>
> Oh, yes.  `may_not_duplicate' works as well.

Technically it does, but I find it is more error prone since I have
to remember to put it on *every* foreign_proc that refers to a global
with static linkage.  And in any case, accessing a global variable is
something that you usually do want to inline.

Julien.
--------------------------------------------------------------------------
mercury-developers mailing list
Post messages to:       mercury-developers at csse.unimelb.edu.au
Administrative Queries: owner-mercury-developers at csse.unimelb.edu.au
Subscriptions:          mercury-developers-request at csse.unimelb.edu.au
--------------------------------------------------------------------------



More information about the developers mailing list