[mercury-users] foreign_decl vs. foreign_code

Tyson Dowd trd at cs.mu.OZ.AU
Tue Feb 12 17:35:31 AEDT 2002


On 12-Feb-2002, Michael Day <mikeday at bigpond.net.au> wrote:
> 
> > You can put #ifdefs around it to make sure it doesn't get defined multiple
> > times.
> > 
> > I believe I argued that this (or something similar) was a bug some time
> > ago, and lost.

This statement of mine is not right -- I was arguing about something
a bit different -- whether multiple foreign_decls should be duplicated
or merged.  It's not relevant to this problem.

> Looks like a bug to me, either in the implementation or failing that in 
> the documentation:
> 
>    Definitions  of foreign language entities (such as functions or global
>    variables) may be included using a declaration of the form...
> 
> The documentation goes on to describe it as being linked in, which 
> certainly makes it sound like it shouldn't be duplicated. And as to the 

I think this is documentation for foreign_code, not foreign_decl.

But foreign_code should not be duplicated, foreign_decls can be
duplicated (e.g. they can be included in multiple places).

> problem manifested in asm_fast.gc grade:
> 
>    Entities declared in `pragma foreign_code' declarations are visible in
>    `pragma  foreign_proc'  declarations  that  specify  the  same foreign
>    language and occur in in the same Mercury module.
> 
> So, something is wrong.

I believe this piece of documentation is wrong, this is not true.
Entities declared in foreign_code might not be visible at all.

Tyson.
--------------------------------------------------------------------------
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