{"issue":{"created_at":"2011-12-12T10:10:00Z","state":"open","updated_at":"2011-12-12T21:57:57Z","comments":1,"user":{"gravatar_id":"f8b77246d47a856dd7deee9f46a35731","id":52674,"url":"https://api.github.com/users/Blei","avatar_url":"https://secure.gravatar.com/avatar/f8b77246d47a856dd7deee9f46a35731?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png","login":"Blei"},"body":"Specifically, it generates multiple instances of one struct. Error message:\r\n\r\n```\r\n###############################\r\nexternal (cdecl) recvmmsg(arg0:Int, arg1:Pointer[Struct_mmsghdr], arg2:UInt, arg3:Int, arg4:Pointer[Struct_timespec]) : Int;\r\n\r\nalias Struct_mmsghdr = Opaque;\r\n------^\r\n\r\nexternal (cdecl) sendmmsg(arg0:Int, arg1:Pointer[Struct_mmsghdr], arg2:UInt, arg3:Int) : Int;\r\n###############################\r\n/home/philipp/programming/clay/build/compiler/src/../../../lib-clay/unix/generated/generated.linux.64.clay(1503,6): error: name redefined: Struct_mmsghdr\r\n```\r\n\r\nExcerpt of the generated file:\r\n\r\n```\r\nalias Struct_mmsghdr = Opaque;\r\nexternal (cdecl) recvmmsg(arg0:Int, arg1:Pointer[Struct_mmsghdr], arg2:UInt, arg3:Int, arg4:Pointer[Struct_timespec]) : Int;\r\nalias Struct_mmsghdr = Opaque;\r\nexternal (cdecl) sendmmsg(arg0:Int, arg1:Pointer[Struct_mmsghdr], arg2:UInt, arg3:Int) : Int;\r\n```\r\n\r\nThis gets generated from the file <bits/socket.h>:\r\n\r\n```c\r\n#ifdef __USE_GNU\r\n/* For `recvmmsg'.  */\r\nstruct mmsghdr\r\n  {\r\n    struct msghdr msg_hdr;\t/* Actual message header.  */\r\n    unsigned int msg_len;\t/* Number of received bytes for the entry.  */\r\n  };\r\n#endif\r\n\r\n[...]\r\n\r\n/* Receive up to VLEN messages as described by VMESSAGES from socket FD.\r\n   Returns the number of bytes read or -1 for errors.\r\n\r\n   This function is a cancellation point and therefore not marked with\r\n   __THROW.  */\r\nextern int recvmmsg (int __fd, struct mmsghdr *__vmessages,\r\n\t\t     unsigned int __vlen, int __flags,\r\n\t\t     __const struct timespec *__tmo);\r\n\r\n/* Send a VLEN messages as described by VMESSAGES to socket FD.\r\n   Return the number of datagrams successfully written or -1 for errors.\r\nThis function is a cancellation point and therefore not marked with\r\n   __THROW.  */\r\nextern int sendmmsg (int __fd, struct mmsghdr *__vmessages,\r\n\t\t     unsigned int __vlen, int __flags);\r\n\r\n```\r\n\r\nAfter removing the duplicate definition, everything works.\r\n\r\nI'm not quite sure what is happening here. Apparently bindgen doesn't pick up the mmsghdr struct (because it doesn't define __USE_GNU?).","assignee":null,"id":2521284,"pull_request":{"patch_url":null,"html_url":null,"diff_url":null},"number":48,"labels":[],"title":"bindgen fails to generate the bindings for unix on linux64","html_url":"https://github.com/jckarter/clay/issues/48","closed_at":null,"url":"https://api.github.com/repos/jckarter/clay/issues/48","milestone":null},"action":"created","comment":{"created_at":"2011-12-12T21:57:57Z","updated_at":"2011-12-12T21:57:57Z","user":{"gravatar_id":"b0dcaf0f709216492c505d3ec167003c","id":147281,"url":"https://api.github.com/users/jckarter","avatar_url":"https://secure.gravatar.com/avatar/b0dcaf0f709216492c505d3ec167003c?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png","login":"jckarter"},"body":"There's some logic to only emit function declarations and defined structs once. It just needs to be generalized to do the same for opaque structs, unions, and enums.","id":3113607,"url":"https://api.github.com/repos/jckarter/clay/issues/comments/3113607"}}