Ticket #47963

inline causes undefined symbol

Open Date: 2023-04-28 23:50 Last Update: 2023-05-02 14:44

Reporter:
Owner:
(None)
Type:
Status:
Closed
Component:
(None)
MileStone:
(None)
Priority:
5 - Medium
Severity:
5 - Medium
Resolution:
None
File:
None

Details

https://stackoverflow.com/questions/16245521/c99-inline-function-in-c-file/16245669#16245669

inline is only a hint such that the compiler doesn't complain about doubly defined symbols. It doesn't guarantee that a function is inlined, nor actually that a symbol is generated, if it is needed. To force the generation of a symbol you'd have to add a sort of instantiation after the inline definition:

int func(int i);

In this case you get:

tmesh> /opt/tme/bin/tmesh: symbol lookup error: /opt/tme/lib/tme/tme_host_gtk.so.0: undefined symbol: _tme_scanline_pad

To fix this change gtk-display.c to include the function prototype after the inline from gtk-display.h

/* includes: */
#include "gtk-display.h"
unsigned int _tme_scanline_pad(int bpl);
#include <stdlib.h>

Ticket History (3/5 Histories)

2023-04-28 23:50 Updated by: ambie
  • New Ticket "inline causes undefined symbol" created
2023-04-30 08:24 Updated by: phabrics
Comment

That would be a problem. It must have been an artifact of factoring out the common display code into display.c. I will just instantiate it in display.c since it is shared by all of the graphical front-end hosts (gtk, sdl, vnc). The common code among them should all be in display.c.

2023-05-01 03:23 Updated by: ambie
Comment

The update to the AUR PKGBUILD resolved this issue for me.

2023-05-01 06:44 Updated by: phabrics
Comment

That's great! I wasn't sure it would work as I couldn't reproduce it. The link you provided indicated that it should and the gcc doc seemed to concur. I will close this ticket after it is checked in to repo.

(Edited, 2023-05-01 06:47 Updated by: phabrics)
2023-05-02 14:44 Updated by: phabrics
  • Status Update from Open to Closed

Attachment File List

No attachments

Edit

You are not logged in. I you are not logged in, your comment will be treated as an anonymous post. » Login