Skip to content

Commit

Permalink
Improving messages and exporting symbol
Browse files Browse the repository at this point in the history
  • Loading branch information
tesonep committed Nov 23, 2021
1 parent b0aa2aa commit b16b6da
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 9 deletions.
2 changes: 1 addition & 1 deletion ffi/src/pThreadedFFI.c
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#include "pThreadedFFI.h"
#include "worker.h"

Worker *mainThreadWorker = NULL;
EXPORT(Worker*) mainThreadWorker = NULL;

EXPORT(sqInt)
runMainThreadWorker() {
Expand Down
14 changes: 6 additions & 8 deletions src/externalPrimitives.c
Original file line number Diff line number Diff line change
Expand Up @@ -186,14 +186,12 @@ getModuleSymbol(void *module, const char *symbol)
FARPROC address = GetProcAddress((HMODULE)(module ? module : GetModuleHandle(NULL)), symbol);

if(address == NULL){
LPVOID lpMsgBuf;
DWORD lastError;

lastError = GetLastError();
FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS,
NULL, GetLastError(), MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
(LPTSTR) &lpMsgBuf, 0, NULL );
logWarn("Looking up symbol %s: %s", symbol, lpMsgBuf);

DWORD errorCode = GetLastError();
char* errorMessage = formatMessageFromErrorCode(errorCode);

logWarn("Looking up symbol %s: %s", symbol, errorMessage);
free(errorMessage);
}

if(address == NULL && module == NULL){
Expand Down

0 comments on commit b16b6da

Please sign in to comment.