[m-users.] C compiler error

Volker Wysk post at volker-wysk.de
Tue Feb 28 01:49:49 AEDT 2023


Hi.

I have a Mercury module with a lot of foreign C code, and I get many
compiler errors like this:

Making Mercury/os/mq.o
Mercury/cs/mq.c: In function ‘null_to_empty’:
Mercury/cs/mq.c:644:1: error: invalid storage class for function
‘mq_module0’
Mercury/cs/mq.c:644:1: error: invalid storage class for function
‘mq_module0’
Mercury/cs/mq.c:764:1: error: invalid storage class for function
‘mq_module1’
Mercury/cs/mq.c:764:1: error: invalid storage class for function
‘mq_module1’
...



The function in question is this:

:- pragma foreign_code("C",
"
  char * null_to_empty(char * str)
  {
    if (str == 0) {
       MR_String str1 = MR_GC_malloc(1);
       *str1 = (char) 0;
       return str1;
    } else {
       return str;
    }
").


I don't understand what those C compiler options are saying...

Volker
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: This is a digitally signed message part
URL: <http://lists.mercurylang.org/archives/users/attachments/20230227/fecb4abb/attachment.sig>


More information about the users mailing list