load libcurl at runtime (#33)

* load libcurl at runtime

* add warning to file tab if curl cant be loaded
This commit is contained in:
WarmUpTill
2020-09-13 09:13:09 +02:00
committed by GitHub
parent 3ec1e99f4b
commit 3fd3801e56
7 changed files with 137 additions and 14 deletions

View File

@@ -0,0 +1,26 @@
#pragma once
#include <curl/curl.h>
#include <QLibrary>
#if defined(WIN32)
#define CURL_LIBRARY_NAME "libcurl.dll"
#elif __APPLE__
#define CURL_LIBRARY_NAME "libcurl.4.dylib"
#else
#define CURL_LIBRARY_NAME "libcurl.so.4"
#endif
typedef CURL *(*initFunction)(void);
typedef CURLcode (*setOptFunction)(CURL *, CURLoption, ...);
typedef CURLcode (*performFunction)(CURL *);
typedef void (*cleanupFunction)(CURL *);
extern initFunction f_curl_init;
extern setOptFunction f_curl_setopt;
extern performFunction f_curl_perform;
extern cleanupFunction f_curl_cleanup;
extern QLibrary *loaded_curl_lib;
bool resolveCurl();
bool loadCurl();

View File

@@ -8,6 +8,7 @@
#include <fstream>
#include <QDateTime>
#include <QThread>
#include <curl/curl.h>
#include "utility.hpp"
#define DEFAULT_INTERVAL 300
@@ -309,6 +310,7 @@ struct SwitcherData {
FileIOData fileIO;
IdleData idleData;
std::vector<FileSwitch> fileSwitches;
CURL *curl = nullptr;
std::vector<ExecutableSceneSwitch> executableSwitches;