Am I correct to assume one cannot forward-declare a library's opaque pointer type?

前端 未结 2 1311
说谎
说谎 2020-12-12 04:11

There are a lot of questions out there about forward declarations and opaque types, but most seem to be from the perspective of the library author, or people trying to use i

2条回答
  •  忘掉有多难
    2020-12-12 04:23

    The library should define FOO for you, either opaquely or transparently, as it's own source refers to FOO.

    #include should get you the prototypes to the functions the library provides, and also the types needed to interact with them.

    If you create your own FOO type, you'll almost certainly get a compile error indicating multiple definition of 'FOO' when you include the function prototypes from the library.

提交回复
热议问题