Incorrect linkage for C++ functions called from C
Bug #1163719 reported by
Michi Henning
This bug affects 1 person
Affects | Status | Importance | Assigned to | Milestone | ||
---|---|---|---|---|---|---|
Unity | ||||||
Phablet |
Fix Released
|
Undecided
|
Unassigned |
Bug Description
In hudclient.cpp, we have:
static void loadingCB(GObject* /*src*/, gpointer dst)
{
static_
}
// ...
g_signal_
The loadingCB is passed to GLib as a callback. This is incorrect as it stands. Declaring a function static only controls its visibility, but not its linkage. It happens to work with gcc, but that's coincidental; on other platforms, this may cause a crash.
To specify C linkage, an extern "C" directive is needed. Also, there is no need for the static keyword; instead, the relevant functions can be placed into an anonymous namespace.
Related branches
lp:~michihenning/unity/fix-c-linkage-1163719
- PS Jenkins bot (community): Approve (continuous-integration)
- Albert Astals Cid (community): Approve
-
Diff: 62 lines (+17/-7)1 file modifiedplugins/HudClient/hudclient.cpp (+17/-7)
Changed in unity: | |
status: | New → In Progress |
Changed in unity: | |
status: | In Progress → Fix Committed |
Changed in unity: | |
status: | Fix Committed → Confirmed |
no longer affects: | unity |
To post a comment you must log in.
Fix committed into lp:unity/phablet at revision 546, scheduled for release in unity, milestone 13.05