[m-dev.] `pragma export' C calling convention & polymorphism
Fergus Henderson
fjh at cs.mu.OZ.AU
Thu Nov 2 00:31:18 AEDT 2000
Hi,
What type should `pragma export' use for polymorphically typed
arguments -- `MR_Word' or `MR_Box'? Currently it is schitzophrenic.
The reference manual says
| Mercury variables of type `int', `float', `char', or `string'
| are passed to and from C as C variables whose type is given by
| the corresponding typedef. Mercury variables of any other
| type are passed as a `MR_Word'
but the compiler uses `MR_Box'. This only makes a difference for
MLDS grades -- for LLDS grades, `MR_Box' is just a typedef for `MR_Word',
but for MLDS grades `MR_Box' is `void *', while `MR_Word' is an
unsigned integer type.
At some point we probably want to change the conventions used by
`pragma export' dramatically, to be something very similar to those
used by the current --high-level-data MLDS back-end. But I don't want
to do that now.
So I guess for now the best solution is to go with what the reference
manual says, and treat the compiler's current behaviour as a bug?
--
Fergus Henderson <fjh at cs.mu.oz.au> | "I have always known that the pursuit
| of excellence is a lethal habit"
WWW: <http://www.cs.mu.oz.au/~fjh> | -- the last words of T. S. Garp.
--------------------------------------------------------------------------
mercury-developers mailing list
Post messages to: mercury-developers at cs.mu.oz.au
Administrative Queries: owner-mercury-developers at cs.mu.oz.au
Subscriptions: mercury-developers-request at cs.mu.oz.au
--------------------------------------------------------------------------
More information about the developers
mailing list