Skip to content

Commit

Permalink
create mythpluginexport.h
Browse files Browse the repository at this point in the history
and use it instead of mythexp.h
MPUBLIC -> MPLUGIN_PUBLIC

or mythbaseexp.h
MBASE_PUBLIC -> MPLUGIN_PUBLIC
  • Loading branch information
ulmus-scott authored and linuxdude42 committed Mar 19, 2022
1 parent 67b97ab commit 67fdc4d
Show file tree
Hide file tree
Showing 14 changed files with 52 additions and 26 deletions.
4 changes: 3 additions & 1 deletion mythplugins/mytharchive/mytharchivehelper/main.cpp
Expand Up @@ -64,6 +64,8 @@
#include <mythlogging.h>
#include <mythavutil.h>

#include <mythpluginexport.h>

extern "C" {
#include <libavcodec/avcodec.h>
#include <libavformat/avformat.h>
Expand Down Expand Up @@ -2256,7 +2258,7 @@ static int isRemote(const QString& filename)
return 1;
}

class MPUBLIC MythArchiveHelperCommandLineParser : public MythCommandLineParser
class MPLUGIN_PUBLIC MythArchiveHelperCommandLineParser : public MythCommandLineParser
{
public:
MythArchiveHelperCommandLineParser();
Expand Down
5 changes: 3 additions & 2 deletions mythplugins/mythgame/mythgame/gamesettings.h
Expand Up @@ -2,12 +2,13 @@
#define GAMESETTINGS_H

// MythTV headers
#include <mythpluginexport.h>
#include <standardsettings.h>

QString GetGameTypeName(const QString &GameType);
QString GetGameTypeExtensions(const QString &GameType);

struct MPUBLIC GameGeneralSettings : public GroupSetting
struct MPLUGIN_PUBLIC GameGeneralSettings : public GroupSetting
{
Q_OBJECT
public:
Expand Down Expand Up @@ -36,7 +37,7 @@ class GamePlayerSetting : public GroupSetting
PlayerId m_id;
};

class MPUBLIC GamePlayersList : public GroupSetting
class MPLUGIN_PUBLIC GamePlayersList : public GroupSetting
{
Q_OBJECT
public:
Expand Down
3 changes: 2 additions & 1 deletion mythplugins/mythmusic/mythmusic/miniplayer.h
@@ -1,13 +1,14 @@
#ifndef MINIPLAYER_H_
#define MINIPLAYER_H_

#include <mythpluginexport.h>
#include <mythscreentype.h>

#include "musiccommon.h"

class QTimer;

class MPUBLIC MiniPlayer : public MusicCommon
class MPLUGIN_PUBLIC MiniPlayer : public MusicCommon
{
Q_OBJECT

Expand Down
7 changes: 4 additions & 3 deletions mythplugins/mythmusic/mythmusic/musiccommon.h
Expand Up @@ -6,6 +6,7 @@
#include <QObject>

// mythtv
#include <mythpluginexport.h>
#include <audiooutput.h>
#include <mythscreentype.h>
#include <musicmetadata.h>
Expand Down Expand Up @@ -44,7 +45,7 @@ enum MusicView

Q_DECLARE_METATYPE(MusicView);

class MPUBLIC MusicCommon : public MythScreenType
class MPLUGIN_PUBLIC MusicCommon : public MythScreenType
{
Q_OBJECT

Expand Down Expand Up @@ -206,7 +207,7 @@ class MPUBLIC MusicCommon : public MythScreenType
MythUIVideo *m_visualizerVideo {nullptr};
};

class MPUBLIC MythMusicVolumeDialog : public MythScreenType
class MPLUGIN_PUBLIC MythMusicVolumeDialog : public MythScreenType
{
Q_OBJECT
public:
Expand All @@ -231,7 +232,7 @@ class MPUBLIC MythMusicVolumeDialog : public MythScreenType
MythUIProgressBar *m_volProgress {nullptr};
};

class MPUBLIC TrackInfoDialog : public MythScreenType
class MPLUGIN_PUBLIC TrackInfoDialog : public MythScreenType
{
Q_OBJECT
public:
Expand Down
4 changes: 2 additions & 2 deletions mythplugins/mythmusic/mythmusic/musicdata.h
Expand Up @@ -7,7 +7,7 @@
#include <QRunnable>

// myth
#include <mythbaseexp.h>
#include <mythpluginexport.h>
#include <mythcorecontext.h>

// mythmusic
Expand Down Expand Up @@ -58,6 +58,6 @@ class MusicData : public QObject
};

// This global variable contains the MusicData instance for the application
extern MBASE_PUBLIC MusicData *gMusicData;
extern MPLUGIN_PUBLIC MusicData *gMusicData;

#endif
5 changes: 3 additions & 2 deletions mythplugins/mythmusic/mythmusic/musicplayer.h
@@ -1,6 +1,7 @@
#ifndef MUSICPLAYER_H_
#define MUSICPLAYER_H_

#include <mythpluginexport.h>
// mythtv
#include <audiooutput.h>
#include <mythobservable.h>
Expand Down Expand Up @@ -264,9 +265,9 @@ Q_DECLARE_METATYPE(MusicPlayer::RepeatMode);
Q_DECLARE_METATYPE(MusicPlayer::ShuffleMode);

// This global variable contains the MusicPlayer instance for the application
extern MPUBLIC MusicPlayer *gPlayer;
extern MPLUGIN_PUBLIC MusicPlayer *gPlayer;

// This stores the last MythMediaDevice that was detected:
extern MPUBLIC QString gCDdevice;
extern MPLUGIN_PUBLIC QString gCDdevice;

#endif
5 changes: 3 additions & 2 deletions mythplugins/mythmusic/mythmusic/playlisteditorview.h
Expand Up @@ -8,6 +8,7 @@
#include <QEvent>
#include <QVector>

#include <mythpluginexport.h>
// mythui
#include <mythscreentype.h>
#include <mythgenerictree.h>
Expand All @@ -21,7 +22,7 @@ class MythUIText;
class MythMenu;

// This is just so we can use the guarded pointers provided by QPointer in the MusicGenericTree
class MPUBLIC MusicButtonItem : public MythUIButtonListItem, public QObject
class MPLUGIN_PUBLIC MusicButtonItem : public MythUIButtonListItem, public QObject
{
public:
MusicButtonItem(MythUIButtonList *lbtype, const QString& text,
Expand All @@ -34,7 +35,7 @@ class MPUBLIC MusicButtonItem : public MythUIButtonListItem, public QObject
MythUIButtonListItem(lbtype, text, std::move(data), listPosition) {}
};

class MPUBLIC MusicGenericTree : public MythGenericTree
class MPLUGIN_PUBLIC MusicGenericTree : public MythGenericTree
{
public:
MusicGenericTree(MusicGenericTree *parent, const QString &name,
Expand Down
3 changes: 2 additions & 1 deletion mythplugins/mythmusic/mythmusic/visualizerview.h
Expand Up @@ -5,6 +5,7 @@
#include <QEvent>
#include <QVector>

#include <mythpluginexport.h>
// mythui
#include <mythscreentype.h>

Expand Down Expand Up @@ -32,7 +33,7 @@ class VisualizerView : public MusicCommon
static void showTrackInfoPopup(void);
};

class MPUBLIC TrackInfoPopup : public MythScreenType
class MPLUGIN_PUBLIC TrackInfoPopup : public MythScreenType
{
Q_OBJECT
public:
Expand Down
4 changes: 3 additions & 1 deletion mythplugins/mythnetvision/mythfillnetvision/main.cpp
Expand Up @@ -23,10 +23,12 @@
#include <mythcommandlineparser.h>
#include <mythlogging.h>

#include <mythpluginexport.h>

GrabberDownloadThread *gdt = nullptr;
RSSManager *rssMan = nullptr;

class MPUBLIC MythFillNVCommandLineParser : public MythCommandLineParser
class MPLUGIN_PUBLIC MythFillNVCommandLineParser : public MythCommandLineParser
{
public:
MythFillNVCommandLineParser();
Expand Down
4 changes: 2 additions & 2 deletions mythplugins/mythzoneminder/mythzoneminder/zmclient.h
Expand Up @@ -6,16 +6,16 @@
#include <vector>

// myth
#include <mythpluginexport.h>
#include <mythsocket.h>
#include <mythbaseexp.h>
#include <mythimage.h>

// zm
#include "zmdefines.h"
#define MAX_IMAGE_SIZE (2048*1536*3)
using FrameData = std::array<uint8_t,MAX_IMAGE_SIZE>;

class MBASE_PUBLIC ZMClient : public QObject
class MPLUGIN_PUBLIC ZMClient : public QObject
{
Q_OBJECT

Expand Down
4 changes: 2 additions & 2 deletions mythplugins/mythzoneminder/mythzoneminder/zmminiplayer.h
@@ -1,13 +1,13 @@
#ifndef ZMMINIPLAYER_H_
#define ZMMINIPLAYER_H_

#include <mythbaseexp.h>
#include <mythpluginexport.h>
#include "zmliveplayer.h"

class QTimer;
class MythUIImage;

class MBASE_PUBLIC ZMMiniPlayer : public ZMLivePlayer
class MPLUGIN_PUBLIC ZMMiniPlayer : public ZMLivePlayer
{
Q_OBJECT

Expand Down
2 changes: 2 additions & 0 deletions mythtv/libs/libmythbase/libmythbase.pro
Expand Up @@ -29,6 +29,7 @@ HEADERS += version.h mythcommandlineparser.h
HEADERS += mythscheduler.h filesysteminfo.h hardwareprofile.h serverpool.h
HEADERS += mythbinaryplist.h signalhandling.h mythtimezone.h mythdate.h
HEADERS += mythplugin.h mythpluginapi.h housekeeper.h
HEADERS += mythpluginexport.h
HEADERS += ffmpeg-mmx.h
HEADERS += mythrandom.h
HEADERS += mythsystemlegacy.h mythtypes.h
Expand Down Expand Up @@ -168,6 +169,7 @@ inc.files += mthread.h mthreadpool.h mythchrono.h
inc.files += filesysteminfo.h hardwareprofile.h bonjourregister.h serverpool.h
inc.files += plist.h signalhandling.h ffmpeg-mmx.h mythdate.h
inc.files += mythplugin.h mythpluginapi.h
inc.files += mythpluginexport.h
inc.files += remotefile.h mythsystemlegacy.h mythtypes.h
inc.files += threadedfilewriter.h mythsingledownload.h mythsession.h
inc.files += mythsorthelper.h mythdbcheck.h
Expand Down
16 changes: 9 additions & 7 deletions mythtv/libs/libmythbase/mythpluginapi.h
@@ -1,15 +1,17 @@
#ifndef MYTHPLUGINAPI_H_
#define MYTHPLUGINAPI_H_

#include "mythbaseexp.h"
#include "mythpluginexport.h"
#include "mythplugin.h" // for MythPluginType

extern "C" {
MBASE_PUBLIC int mythplugin_init(const char *libversion);
MBASE_PUBLIC int mythplugin_run();
MBASE_PUBLIC int mythplugin_config();
MBASE_PUBLIC MythPluginType mythplugin_type();
MBASE_PUBLIC void mythplugin_destroy();
extern "C++"
{
MPLUGIN_PUBLIC int mythplugin_init(const char *libversion);
MPLUGIN_PUBLIC int mythplugin_run();
MPLUGIN_PUBLIC int mythplugin_config();
MPLUGIN_PUBLIC MythPluginType mythplugin_type();
MPLUGIN_PUBLIC void mythplugin_destroy();

}

#endif // MYTHPLUGINAPI_H_
12 changes: 12 additions & 0 deletions mythtv/libs/libmythbase/mythpluginexport.h
@@ -0,0 +1,12 @@
#ifndef MYTH_PLUGIN_EXPORT_H_
#define MYTH_PLUGIN_EXPORT_H_

#include <QtGlobal>

#ifdef MPLUGIN_API
# define MPLUGIN_PUBLIC Q_DECL_EXPORT
#else
# define MPLUGIN_PUBLIC Q_DECL_IMPORT
#endif

#endif // MYTH_PLUGIN_EXPORT_H_

2 comments on commit 67fdc4d

@paul-h
Copy link
Contributor

@paul-h paul-h commented on 67fdc4d Mar 19, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do the plugins load OK for you after this commit?

I'm seeing these errors

2022-03-19 22:47:45.585295 ! [149748/149748] CoreContext mythplugin.cpp:36:init  MythPlugin::init() dlerror: /usr/lib/mythtv/plugins/libmytharchive.so: undefined symbol: mythplugin_init
2022-03-19 22:47:45.585303 E [149748/149748] CoreContext mythplugin.cpp:140:init_plugin  Unable to initialize plugin 'mytharchive'.
2022-03-19 22:47:45.588225 ! [149748/149748] CoreContext mythplugin.cpp:36:init  MythPlugin::init() dlerror: /usr/lib/mythtv/plugins/libmythbrowser.so: undefined symbol: mythplugin_init
2022-03-19 22:47:45.588229 E [149748/149748] CoreContext mythplugin.cpp:140:init_plugin  Unable to initialize plugin 'mythbrowser'.
2022-03-19 22:47:45.592232 ! [149748/149748] CoreContext mythplugin.cpp:36:init  MythPlugin::init() dlerror: /usr/lib/mythtv/plugins/libmythmusic.so: undefined symbol: mythplugin_init
2022-03-19 22:47:45.592236 E [149748/149748] CoreContext mythplugin.cpp:140:init_plugin  Unable to initialize plugin 'mythmusic'.
2022-03-19 22:47:45.594571 ! [149748/149748] CoreContext mythplugin.cpp:36:init  MythPlugin::init() dlerror: /usr/lib/mythtv/plugins/libmythnews.so: undefined symbol: mythplugin_init
2022-03-19 22:47:45.594574 E [149748/149748] CoreContext mythplugin.cpp:140:init_plugin  Unable to initialize plugin 'mythnews'.
2022-03-19 22:47:45.597146 ! [149748/149748] CoreContext mythplugin.cpp:36:init  MythPlugin::init() dlerror: /usr/lib/mythtv/plugins/libmythweather.so: undefined symbol: mythplugin_init
2022-03-19 22:47:45.597150 E [149748/149748] CoreContext mythplugin.cpp:140:init_plugin  Unable to initialize plugin 'mythweather'.
2022-03-19 22:47:45.599865 ! [149748/149748] CoreContext mythplugin.cpp:36:init  MythPlugin::init() dlerror: /usr/lib/mythtv/plugins/libmythzoneminder.so: undefined symbol: mythplugin_init
2022-03-19 22:47:45.599868 E [149748/149748] CoreContext mythplugin.cpp:140:init_plugin  Unable to initialize plugin 'mythzoneminder'.

@linuxdude42
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The extern "C++" statement needs to be extern "C" . MythTV can't find the mythplugin_init symbol because its been mangled into C++ form.

Please sign in to comment.