Ignore header file with module?

Hi all,

Is there a way to ignore a specific header file when declaring a C dependency? I’m working with a library that publicly declares `flash` as a struct, and that conflicts with `ncurses`’s definition of `flash`. His code makes no use of curses.h, and I won’t be using it either.

Is there any way I can specifically exclude `curses.h` from my modulemap file? It’s a very simple file.

module CFlipper [system] {
    umbrella "/usr/local/include/flipper/"
    link "flipper"
    export *
}

Try using:
  exclude header "/path/to/header.h"
in the module definition.

- Daniel

···

On Dec 4, 2015, at 3:06 PM, Harlan Haskins <harlan@harlanhaskins.com> wrote:

Hi all,

Is there a way to ignore a specific header file when declaring a C dependency? I’m working with a library that publicly declares `flash` as a struct, and that conflicts with `ncurses`’s definition of `flash`. His code makes no use of curses.h, and I won’t be using it either.

Is there any way I can specifically exclude `curses.h` from my modulemap file? It’s a very simple file.

module CFlipper [system] {
    umbrella "/usr/local/include/flipper/"
    link "flipper"
    export *
}

_______________________________________________
swift-users mailing list
swift-users@swift.org
https://lists.swift.org/mailman/listinfo/swift-users

+swift-users, again

Yes, the flash struct is necessary, and we can’t really rename it. :confused:

···

On Dec 4, 2015, at 6:27 PM, Daniel Dunbar <daniel_dunbar@apple.com> wrote:

I see now I misunderstood your question, I thought you just wanted to exclude a particular header that was in flipper that defined that struct, so that it wouldn't conflict.

Is the header that defines said struct in the flipper necessary for your client?

(FYI probably best to keep swift-users in the CC list if possible just so others can benefit from the info).

- Daniel

On Dec 4, 2015, at 3:16 PM, Harlan Haskins <harlan@harlanhaskins.com <mailto:harlan@harlanhaskins.com>> wrote:

Ah! I somehow missed that keyword in the docs.

However, it seems the path is /Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/usr/include/curses.h

If I intend this to be cross-platform, how can I exclude that file in a non-Mac specific way?

Also it doesn’t seem to be excluding anything — I still get the issue.

My file is currently

module CFlipper [system] {
    exclude header "/Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/usr/include/curses.h"
    exclude header "/Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/usr/include/search.h"
    umbrella "/Users/harlan/.flipper/include/"
    link "flipper"
    export *
}

On Dec 4, 2015, at 6:08 PM, Daniel Dunbar <daniel_dunbar@apple.com <mailto:daniel_dunbar@apple.com>> wrote:

Try using:
  exclude header "/path/to/header.h"
in the module definition.

- Daniel

On Dec 4, 2015, at 3:06 PM, Harlan Haskins <harlan@harlanhaskins.com <mailto:harlan@harlanhaskins.com>> wrote:

Hi all,

Is there a way to ignore a specific header file when declaring a C dependency? I’m working with a library that publicly declares `flash` as a struct, and that conflicts with `ncurses`’s definition of `flash`. His code makes no use of curses.h, and I won’t be using it either.

Is there any way I can specifically exclude `curses.h` from my modulemap file? It’s a very simple file.

module CFlipper [system] {
    umbrella "/usr/local/include/flipper/"
    link "flipper"
    export *
}

_______________________________________________
swift-users mailing list
swift-users@swift.org <mailto:swift-users@swift.org>
https://lists.swift.org/mailman/listinfo/swift-users

(+Jordan, who may have some good ideas)

This is going to be problematic, I am not sure yet how to deal with this.

Can you explain more about exactly how this ends up failing? Do you have code which imports both Darwin and flipper?

- Daniel

···

On Dec 4, 2015, at 3:49 PM, Harlan Haskins <harlan@harlanhaskins.com> wrote:

+swift-users, again

Yes, the flash struct is necessary, and we can’t really rename it. :confused:

On Dec 4, 2015, at 6:27 PM, Daniel Dunbar <daniel_dunbar@apple.com <mailto:daniel_dunbar@apple.com>> wrote:

I see now I misunderstood your question, I thought you just wanted to exclude a particular header that was in flipper that defined that struct, so that it wouldn't conflict.

Is the header that defines said struct in the flipper necessary for your client?

(FYI probably best to keep swift-users in the CC list if possible just so others can benefit from the info).

- Daniel

On Dec 4, 2015, at 3:16 PM, Harlan Haskins <harlan@harlanhaskins.com <mailto:harlan@harlanhaskins.com>> wrote:

Ah! I somehow missed that keyword in the docs.

However, it seems the path is /Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/usr/include/curses.h

If I intend this to be cross-platform, how can I exclude that file in a non-Mac specific way?

Also it doesn’t seem to be excluding anything — I still get the issue.

My file is currently

module CFlipper [system] {
    exclude header "/Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/usr/include/curses.h"
    exclude header "/Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/usr/include/search.h"
    umbrella "/Users/harlan/.flipper/include/"
    link "flipper"
    export *
}

On Dec 4, 2015, at 6:08 PM, Daniel Dunbar <daniel_dunbar@apple.com <mailto:daniel_dunbar@apple.com>> wrote:

Try using:
  exclude header "/path/to/header.h"
in the module definition.

- Daniel

On Dec 4, 2015, at 3:06 PM, Harlan Haskins <harlan@harlanhaskins.com <mailto:harlan@harlanhaskins.com>> wrote:

Hi all,

Is there a way to ignore a specific header file when declaring a C dependency? I’m working with a library that publicly declares `flash` as a struct, and that conflicts with `ncurses`’s definition of `flash`. His code makes no use of curses.h, and I won’t be using it either.

Is there any way I can specifically exclude `curses.h` from my modulemap file? It’s a very simple file.

module CFlipper [system] {
    umbrella "/usr/local/include/flipper/"
    link "flipper"
    export *
}

_______________________________________________
swift-users mailing list
swift-users@swift.org <mailto:swift-users@swift.org>
https://lists.swift.org/mailman/listinfo/swift-users

So what happens is flipper.h declares a struct called `flash`. When I use `swift build` to build that module, I get this error:

/Users/harlan/.flipper/include/flash/flash.h:29:3: error: redefinition of 'flash' as different kind of symbol
} flash;
  ^
/Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/usr/include/ncurses.h:566:28: note: previous definition is here
extern NCURSES_EXPORT(int) flash (void); /* implemented */

Even though I have no need for `curses.h` at all.

···

On Dec 4, 2015, at 6:55 PM, Daniel Dunbar <daniel_dunbar@apple.com> wrote:

(+Jordan, who may have some good ideas)

This is going to be problematic, I am not sure yet how to deal with this.

Can you explain more about exactly how this ends up failing? Do you have code which imports both Darwin and flipper?

- Daniel

On Dec 4, 2015, at 3:49 PM, Harlan Haskins <harlan@harlanhaskins.com <mailto:harlan@harlanhaskins.com>> wrote:

+swift-users, again

Yes, the flash struct is necessary, and we can’t really rename it. :confused:

On Dec 4, 2015, at 6:27 PM, Daniel Dunbar <daniel_dunbar@apple.com <mailto:daniel_dunbar@apple.com>> wrote:

I see now I misunderstood your question, I thought you just wanted to exclude a particular header that was in flipper that defined that struct, so that it wouldn't conflict.

Is the header that defines said struct in the flipper necessary for your client?

(FYI probably best to keep swift-users in the CC list if possible just so others can benefit from the info).

- Daniel

On Dec 4, 2015, at 3:16 PM, Harlan Haskins <harlan@harlanhaskins.com <mailto:harlan@harlanhaskins.com>> wrote:

Ah! I somehow missed that keyword in the docs.

However, it seems the path is /Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/usr/include/curses.h

If I intend this to be cross-platform, how can I exclude that file in a non-Mac specific way?

Also it doesn’t seem to be excluding anything — I still get the issue.

My file is currently

module CFlipper [system] {
    exclude header "/Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/usr/include/curses.h"
    exclude header "/Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/usr/include/search.h"
    umbrella "/Users/harlan/.flipper/include/"
    link "flipper"
    export *
}

On Dec 4, 2015, at 6:08 PM, Daniel Dunbar <daniel_dunbar@apple.com <mailto:daniel_dunbar@apple.com>> wrote:

Try using:
  exclude header "/path/to/header.h"
in the module definition.

- Daniel

On Dec 4, 2015, at 3:06 PM, Harlan Haskins <harlan@harlanhaskins.com <mailto:harlan@harlanhaskins.com>> wrote:

Hi all,

Is there a way to ignore a specific header file when declaring a C dependency? I’m working with a library that publicly declares `flash` as a struct, and that conflicts with `ncurses`’s definition of `flash`. His code makes no use of curses.h, and I won’t be using it either.

Is there any way I can specifically exclude `curses.h` from my modulemap file? It’s a very simple file.

module CFlipper [system] {
    umbrella "/usr/local/include/flipper/"
    link "flipper"
    export *
}

_______________________________________________
swift-users mailing list
swift-users@swift.org <mailto:swift-users@swift.org>
https://lists.swift.org/mailman/listinfo/swift-users

:-( I'm pretty sure the modules system today has zero way around this. Doug?

Jordan

···

On Dec 4, 2015, at 16:15 , Harlan Haskins <harlan@harlanhaskins.com> wrote:

So what happens is flipper.h declares a struct called `flash`. When I use `swift build` to build that module, I get this error:

/Users/harlan/.flipper/include/flash/flash.h:29:3: error: redefinition of 'flash' as different kind of symbol
} flash;
  ^
/Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/usr/include/ncurses.h:566:28: note: previous definition is here
extern NCURSES_EXPORT(int) flash (void); /* implemented */

Even though I have no need for `curses.h` at all.

On Dec 4, 2015, at 6:55 PM, Daniel Dunbar <daniel_dunbar@apple.com <mailto:daniel_dunbar@apple.com>> wrote:

(+Jordan, who may have some good ideas)

This is going to be problematic, I am not sure yet how to deal with this.

Can you explain more about exactly how this ends up failing? Do you have code which imports both Darwin and flipper?

- Daniel

On Dec 4, 2015, at 3:49 PM, Harlan Haskins <harlan@harlanhaskins.com <mailto:harlan@harlanhaskins.com>> wrote:

+swift-users, again

Yes, the flash struct is necessary, and we can’t really rename it. :confused:

On Dec 4, 2015, at 6:27 PM, Daniel Dunbar <daniel_dunbar@apple.com <mailto:daniel_dunbar@apple.com>> wrote:

I see now I misunderstood your question, I thought you just wanted to exclude a particular header that was in flipper that defined that struct, so that it wouldn't conflict.

Is the header that defines said struct in the flipper necessary for your client?

(FYI probably best to keep swift-users in the CC list if possible just so others can benefit from the info).

- Daniel

On Dec 4, 2015, at 3:16 PM, Harlan Haskins <harlan@harlanhaskins.com <mailto:harlan@harlanhaskins.com>> wrote:

Ah! I somehow missed that keyword in the docs.

However, it seems the path is /Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/usr/include/curses.h

If I intend this to be cross-platform, how can I exclude that file in a non-Mac specific way?

Also it doesn’t seem to be excluding anything — I still get the issue.

My file is currently

module CFlipper [system] {
    exclude header "/Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/usr/include/curses.h"
    exclude header "/Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/usr/include/search.h"
    umbrella "/Users/harlan/.flipper/include/"
    link "flipper"
    export *
}

On Dec 4, 2015, at 6:08 PM, Daniel Dunbar <daniel_dunbar@apple.com <mailto:daniel_dunbar@apple.com>> wrote:

Try using:
  exclude header "/path/to/header.h"
in the module definition.

- Daniel

On Dec 4, 2015, at 3:06 PM, Harlan Haskins <harlan@harlanhaskins.com <mailto:harlan@harlanhaskins.com>> wrote:

Hi all,

Is there a way to ignore a specific header file when declaring a C dependency? I’m working with a library that publicly declares `flash` as a struct, and that conflicts with `ncurses`’s definition of `flash`. His code makes no use of curses.h, and I won’t be using it either.

Is there any way I can specifically exclude `curses.h` from my modulemap file? It’s a very simple file.

module CFlipper [system] {
    umbrella "/usr/local/include/flipper/"
    link "flipper"
    export *
}

_______________________________________________
swift-users mailing list
swift-users@swift.org <mailto:swift-users@swift.org>
https://lists.swift.org/mailman/listinfo/swift-users

Is there a way I can tell this not to compile with the OS X SDK? The C library is responsible for including all the headers it needs.

···

On Dec 4, 2015, at 7:15 PM, Harlan Haskins <harlan@harlanhaskins.com> wrote:

So what happens is flipper.h declares a struct called `flash`. When I use `swift build` to build that module, I get this error:

/Users/harlan/.flipper/include/flash/flash.h:29:3: error: redefinition of 'flash' as different kind of symbol
} flash;
  ^
/Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/usr/include/ncurses.h:566:28: note: previous definition is here
extern NCURSES_EXPORT(int) flash (void); /* implemented */

Even though I have no need for `curses.h` at all.

On Dec 4, 2015, at 6:55 PM, Daniel Dunbar <daniel_dunbar@apple.com> wrote:

(+Jordan, who may have some good ideas)

This is going to be problematic, I am not sure yet how to deal with this.

Can you explain more about exactly how this ends up failing? Do you have code which imports both Darwin and flipper?

- Daniel

On Dec 4, 2015, at 3:49 PM, Harlan Haskins <harlan@harlanhaskins.com> wrote:

+swift-users, again

Yes, the flash struct is necessary, and we can’t really rename it. :confused:

On Dec 4, 2015, at 6:27 PM, Daniel Dunbar <daniel_dunbar@apple.com> wrote:

I see now I misunderstood your question, I thought you just wanted to exclude a particular header that was in flipper that defined that struct, so that it wouldn't conflict.

Is the header that defines said struct in the flipper necessary for your client?

(FYI probably best to keep swift-users in the CC list if possible just so others can benefit from the info).

- Daniel

On Dec 4, 2015, at 3:16 PM, Harlan Haskins <harlan@harlanhaskins.com> wrote:

Ah! I somehow missed that keyword in the docs.

However, it seems the path is /Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/usr/include/curses.h

If I intend this to be cross-platform, how can I exclude that file in a non-Mac specific way?

Also it doesn’t seem to be excluding anything — I still get the issue.

My file is currently

module CFlipper [system] {
    exclude header "/Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/usr/include/curses.h"
    exclude header "/Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/usr/include/search.h"
    umbrella "/Users/harlan/.flipper/include/"
    link "flipper"
    export *
}

On Dec 4, 2015, at 6:08 PM, Daniel Dunbar <daniel_dunbar@apple.com> wrote:

Try using:
  exclude header "/path/to/header.h"
in the module definition.

- Daniel

On Dec 4, 2015, at 3:06 PM, Harlan Haskins <harlan@harlanhaskins.com> wrote:

Hi all,

Is there a way to ignore a specific header file when declaring a C dependency? I’m working with a library that publicly declares `flash` as a struct, and that conflicts with `ncurses`’s definition of `flash`. His code makes no use of curses.h, and I won’t be using it either.

Is there any way I can specifically exclude `curses.h` from my modulemap file? It’s a very simple file.

module CFlipper [system] {
    umbrella "/usr/local/include/flipper/"
    link "flipper"
    export *
}

_______________________________________________
swift-users mailing list
swift-users@swift.org
https://lists.swift.org/mailman/listinfo/swift-users

_______________________________________________
swift-users mailing list
swift-users@swift.org
https://lists.swift.org/mailman/listinfo/swift-users