Corrections to complete the port to MingW

This commit is contained in:
2023-02-20 18:03:34 -05:00
parent 6c8ee78041
commit 3eebe7dc33
2 changed files with 24 additions and 4 deletions

View File

@@ -3,18 +3,22 @@
#include "drvutil.hpp"
#include "sslutil.hpp"
#include "../cpp/enginewrapper.hpp"
#include "../core/enginewrapper.hpp"
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cassert>
#include <map>
#include <vector>
#include <string>
#include <filesystem>
#include <winsock2.h>
#include <ws2tcpip.h>
#include <synchapi.h>
#include <sysinfoapi.h>
#include <libloaderapi.h>
#include <windows.h>
#include <openssl/ssl.h>
#include <openssl/rsa.h>
@@ -194,7 +198,7 @@ static int socket_poll(struct pollfd *pollvec, int pollcount, int mstimeout, std
}
int status = WSAPoll(pollvec, pollcount, mstimeout);
if (status < 0) {
err = strerror_str(WSAGetLastError());
err = drvutil::strerror_str(WSAGetLastError());
return -1;
}
return status;
@@ -266,13 +270,28 @@ static void ssl_load_certificate_authorities(SSL_CTX *ctx) {
CertCloseStore(hStore, 0);
}
// Load the DLL if it's not already loaded. Stores
// the handle in a global variable.
static void load_engine_dll() {
// Not actually implemented yet. Currently, the engine
// is linked right into the executable.
}
static void call_init_engine_wrapper(EngineWrapper *w) {
load_engine_dll();
using InitFn = void (*)(EngineWrapper *);
InitFn initfn = (InitFn)GetProcAddress(GetModuleHandle(NULL), "init_engine_wrapper");
assert(initfn != nullptr);
initfn(w);
}
#include "driver-common.cpp"
int main(int argc, char **argv)
{
init_winsock();
OPENSSL_init_ssl(0, NULL);
SourceDB::register_lua_builtins();
assert(OPENSSL_init_ssl(0, NULL) == 1);
sslutil::clear_all_errors();
Driver driver;
return driver.drive(argc, argv);
}