gtk-rs / glib

DEPRECATED, use https://github.com/gtk-rs/gtk-rs-core repository instead!
http://gtk-rs.org/
MIT License
93 stars 62 forks source link

Fix for g_param_spec_types symbol linking error with MSVC #695

Closed seungha-yang closed 4 years ago

seungha-yang commented 4 years ago

Regression from https://github.com/gtk-rs/glib/pull/688

cc: @sdroege

seungha-yang commented 4 years ago

Sorry for this unclear commit message. (I don't fully understand why #[no_mangle] is needed here).

I've seen this build error with gst-plugins-rs

libglib-20259afa4dec16ec.rlib(glib-20259afa4dec16ec.glib.8h6me5m7-cgu.8.rcgu.o) : error LNK2019: unresolved external symbol g_param_spec_types referenced in function _ZN92_$LT$glib..param_spec..param_spec_char..ParamSpecChar$u20$as$u20$glib..types..StaticType$GT$11static_type17h09c13f9e266f0171E
libglib-20259afa4dec16ec.rlib(glib-20259afa4dec16ec.glib.8h6me5m7-cgu.11.rcgu.o) : error LNK2001: unresolved external symbol g_param_spec_types
...
sdroege commented 4 years ago

Curious:

warning: attribute should be applied to a function or static

   --> /home/travis/build/gtk-rs/glib/src/param_spec.rs:615:5

    |

615 |     #[no_mangle]

    |     ^^^^^^^^^^^^

616 |     pub static g_param_spec_types: *const glib_sys::GType;

    |     ------------------------------------------------------ not a function or static

    |

    = note: `#[warn(unused_attributes)]` on by default

    = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!