Let native callbacks be defined in shared libraries.

This commit is contained in:
Andy Fillebrown 2019-03-25 16:34:05 -04:00
parent 90704aa526
commit 3ccc077406
2 changed files with 6 additions and 1 deletions

View file

@ -18,9 +18,11 @@
#define HOSTFXR_DLL_NAME "libhostfxr.so"
#endif
static QString nativeModule;
static void* getExportedFunction(const char* symbolName) {
#ifdef _WIN32
HMODULE library = GetModuleHandle(nullptr);
HMODULE library = GetModuleHandle(nativeModule.toLocal8Bit());
FARPROC symbol = GetProcAddress(library, symbolName);
return (void*)symbol;
#else
@ -132,6 +134,8 @@ CoreHost::HostFxrContext CoreHost::findHostFxr()
int CoreHost::run(QGuiApplication& app, QQmlApplicationEngine& engine, runCallback runCallback, RunContext runContext)
{
nativeModule = runContext.nativeModule;
QList<QString> execArgs;
execArgs.push_back(runContext.entryPoint);
execArgs.push_back("exec");

View file

@ -26,6 +26,7 @@ public:
QString entryPoint;
QString managedExe;
QList<QString> args;
QString nativeModule;
};
enum LoadHostFxrResult