0

I'm trying to compile this older npm package on Windows using the latest version of node and it's throwing some C compiler errors that I just don't understand. Any help understanding these errors and how to address them would be greatly appreciated.

Here is the file that throws the error:

#include <node.h>
#include <v8.h>
#include <Windows.h>
#include <iostream>

#include "WINTAB.H"

#include "Utils.h"
char* gpszProgramName = "node_wintab";

#include "MSGPACK.H"

#define PACKETDATA (PK_X | PK_Y | PK_NORMAL_PRESSURE | PK_STATUS | PK_ORIENTATION)
#define PACKETMODE PK_BUTTONS
#include "PKTDEF.H"

using namespace v8;
using namespace std;

int pen_x = -1;
int pen_y = -1;
int pen_pressure = -1;
int pressure_min = -1;
int pressure_max = -1;
bool is_eraser = FALSE;
int azimuth = 0;
int altitude = 0;
int twist = 0;
int azimuth_min = -1;
int azimuth_max = -1;
int altitude_min = -1;
int altitude_max = -1;

void get_pressure(const FunctionCallbackInfo<Value>& info) {
    if (pen_pressure < 0) {
        info.GetReturnValue().SetNull();
    } else {
        info.GetReturnValue().Set(pen_pressure);
    }
}

void get_pen_x(const FunctionCallbackInfo<Value>& info) {
    info.GetReturnValue().Set(pen_x);
}

void get_pen_y(const FunctionCallbackInfo<Value>& info) {
    info.GetReturnValue().Set(pen_y);
}

void get_azimuth(const FunctionCallbackInfo<Value>& info) {
    info.GetReturnValue().Set(azimuth);
}

void get_altitude(const FunctionCallbackInfo<Value>& info) {
    info.GetReturnValue().Set(altitude);
}

void get_twist(const FunctionCallbackInfo<Value>& info) {
    info.GetReturnValue().Set(twist);
}

void get_azimuth_min(const FunctionCallbackInfo<Value>& info) {
    info.GetReturnValue().Set(azimuth_min);
}

void get_azimuth_max(const FunctionCallbackInfo<Value>& info) {
    info.GetReturnValue().Set(azimuth_max);
}

void get_altitude_min(const FunctionCallbackInfo<Value>& info) {
    info.GetReturnValue().Set(altitude_min);
}

void get_altitude_max(const FunctionCallbackInfo<Value>& info) {
    info.GetReturnValue().Set(altitude_max);
}

void get_pressure_min(const FunctionCallbackInfo<Value>& info) {
    if (pressure_min < 0) {
        info.GetReturnValue().SetNull();
    }
    else {
        info.GetReturnValue().Set(pressure_min);
    }
}

void get_pressure_max(const FunctionCallbackInfo<Value>& info) {
    if (pressure_max < 0) {
        info.GetReturnValue().SetNull();
    }
    else {
        info.GetReturnValue().Set(pressure_max);
    }
}

void check_eraser(const FunctionCallbackInfo<Value>& info) {
    info.GetReturnValue().Set(is_eraser);
}

HINSTANCE hinst;
WNDCLASS wc;
HWND hwnd;

HCTX hctx;
LOGCONTEXT lc = {0};

bool overlapped = FALSE;

void peek_message(const FunctionCallbackInfo<Value>& info) {
    MSG msg;
    while (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE)) {
        TranslateMessage(&msg);
        DispatchMessage(&msg);
    }
    info.GetReturnValue().SetUndefined();
}

void check_overlapped(const FunctionCallbackInfo<Value>& info) {
    bool tmp = overlapped;
    overlapped = FALSE;
    info.GetReturnValue().Set(tmp);
}

void enable_context(const FunctionCallbackInfo<Value>& info) {
    if (hctx) {
        gpWTEnable(hctx, TRUE);
        gpWTOverlap(hctx, TRUE);
    }
    info.GetReturnValue().SetUndefined();
}

HCTX initTablet(HWND hwnd) {
    AXIS TabletX = {0};
    AXIS TabletY = {0};
    AXIS Pressure = {0};
    lc.lcOptions |= CXO_SYSTEM;
    if (gpWTInfoA(WTI_DEFSYSCTX, 0, &lc) != sizeof(LOGCONTEXT))
        return (HCTX) NULL;
    if (!(lc.lcOptions & CXO_SYSTEM))
        return (HCTX) NULL;
    wsprintf(lc.lcName, "node_wintab_%x", hinst);
    lc.lcPktData = PACKETDATA;
    lc.lcOptions |= CXO_MESSAGES;
    lc.lcPktMode = PACKETMODE;
    lc.lcMoveMask = PACKETDATA;
    lc.lcBtnUpMask = lc.lcBtnDnMask;
    if (gpWTInfoA(WTI_DEVICES, DVC_X, &TabletX) != sizeof(AXIS))
        return (HCTX) NULL;
    if (gpWTInfoA(WTI_DEVICES, DVC_Y, &TabletY) != sizeof(AXIS))
        return (HCTX) NULL;
    if (gpWTInfoA(WTI_DEVICES, DVC_NPRESSURE, &Pressure) != sizeof(AXIS))
        return (HCTX) NULL;
    lc.lcInOrgX = 0;
    lc.lcInOrgY = 0;
    lc.lcInExtX = TabletX.axMax;
    lc.lcInExtY = TabletY.axMax;
    lc.lcOutOrgX = 0;
    lc.lcOutOrgY = 0;
    lc.lcOutExtX = GetSystemMetrics(SM_CXSCREEN);
    lc.lcOutExtY = -GetSystemMetrics(SM_CYSCREEN);
    lc.lcSysOrgX = 0;
    lc.lcSysOrgY = 0;
    lc.lcSysExtX = GetSystemMetrics(SM_CXSCREEN);
    lc.lcSysExtY = GetSystemMetrics(SM_CYSCREEN);

    pressure_min = (int) Pressure.axMin;
    pressure_max = (int) Pressure.axMax;

    struct tagAXIS tiltOrient[3];
    BOOL tiltSupport = FALSE;
    tiltSupport = gpWTInfoA(WTI_DEVICES, DVC_ORIENTATION, &tiltOrient);
    if (tiltSupport )
    {
        // Does the tablet support azimuth and altitude
        if (tiltOrient[0].axResolution && tiltOrient[1].axResolution)
        {
            // Get resolution
            azimuth_min = tiltOrient[0].axMin;
            azimuth_max = tiltOrient[0].axMax;
            altitude_min = tiltOrient[1].axMin;
            altitude_max = tiltOrient[1].axMax;
        }
        else
        {
            tiltSupport = FALSE;
        }
    }

    return gpWTOpenA(hwnd, &lc, TRUE);
}

LRESULT msgLoop(HWND hwnd, unsigned msg, WPARAM wp, LPARAM lp) {
    PACKET pkt;
    switch (msg) {
    case WM_CREATE:
        hctx = initTablet(hwnd);
        break;
    case WM_NCCREATE:
        break;
    case WT_PACKET:
        if (gpWTPacket((HCTX) lp, wp, &pkt)) {
            pen_x = (int) pkt.pkX;
            pen_y = (int) pkt.pkY;
            pen_pressure = (int) pkt.pkNormalPressure;
            is_eraser = (bool) (pkt.pkStatus & TPS_INVERT);
            azimuth = (int) pkt.pkOrientation.orAzimuth;
            altitude = (int) pkt.pkOrientation.orAltitude;
            twist = (int) pkt.pkOrientation.orTwist;
        }
        break;
    case WT_CTXOVERLAP:
        overlapped = TRUE;
        break;
    case WT_PROXIMITY:
        pen_x = -1;
        pen_y = -1;
        pen_pressure = -1;
        is_eraser = FALSE;
        azimuth = -1;
        altitude = -1;
        twist = -1;
        break;
    default:
        return (LRESULT) 0L;
    }
    return DefWindowProc(hwnd, msg, wp, lp);
}

void init(Local<Object> exports) {
    hinst = (HINSTANCE) GetModuleHandle(NULL);
    wc.style = 0;
    wc.lpfnWndProc = (WNDPROC) msgLoop;
    wc.cbClsExtra = 0;
    wc.cbWndExtra = 0;
    wc.hInstance = hinst;
    wc.hIcon = LoadIcon(NULL, IDI_APPLICATION);
    wc.hCursor = LoadCursor(NULL, IDC_ARROW);
    wc.hbrBackground = (HBRUSH) (COLOR_APPWORKSPACE + 1);
    wc.lpszMenuName =  "wintabMenu";
    wc.lpszClassName = "wintabClass";
    RegisterClass(&wc);
    LoadWintab();
    hwnd = CreateWindow(
        "wintabClass",
        "wintabWindow",
        WS_OVERLAPPED, CW_USEDEFAULT, CW_USEDEFAULT,
        CW_USEDEFAULT, CW_USEDEFAULT, (HWND) NULL,
        (HMENU) NULL, hinst, (LPVOID) NULL
    );
    Isolate* isolate = Isolate::GetCurrent();
    exports->Set(String::NewFromUtf8(isolate, "pressure"), FunctionTemplate::New(isolate, get_pressure)->GetFunction());
    exports->Set(String::NewFromUtf8(isolate, "x"), FunctionTemplate::New(isolate, get_pen_x)->GetFunction());
    exports->Set(String::NewFromUtf8(isolate, "y"), FunctionTemplate::New(isolate, get_pen_y)->GetFunction());
    exports->Set(String::NewFromUtf8(isolate, "azimuth"), FunctionTemplate::New(isolate, get_azimuth)->GetFunction());
    exports->Set(String::NewFromUtf8(isolate, "altitude"), FunctionTemplate::New(isolate, get_altitude)->GetFunction());
    exports->Set(String::NewFromUtf8(isolate, "twist"), FunctionTemplate::New(isolate, get_twist)->GetFunction());
    exports->Set(String::NewFromUtf8(isolate, "azimuthMin"), FunctionTemplate::New(isolate, get_azimuth_min)->GetFunction());
    exports->Set(String::NewFromUtf8(isolate, "azimuthMax"), FunctionTemplate::New(isolate, get_azimuth_max)->GetFunction());
    exports->Set(String::NewFromUtf8(isolate, "altitudeMin"), FunctionTemplate::New(isolate, get_altitude_min)->GetFunction());
    exports->Set(String::NewFromUtf8(isolate, "altitudeMax"), FunctionTemplate::New(isolate, get_altitude_max)->GetFunction());
    exports->Set(String::NewFromUtf8(isolate, "minPressure"), FunctionTemplate::New(isolate, get_pressure_min)->GetFunction());
    exports->Set(String::NewFromUtf8(isolate, "maxPressure"), FunctionTemplate::New(isolate, get_pressure_max)->GetFunction());
    exports->Set(String::NewFromUtf8(isolate, "isEraser"), FunctionTemplate::New(isolate, check_eraser)->GetFunction());
    exports->Set(String::NewFromUtf8(isolate, "peekMessage"), FunctionTemplate::New(isolate, peek_message)->GetFunction());
    exports->Set(String::NewFromUtf8(isolate, "checkOverlapped"), FunctionTemplate::New(isolate, check_overlapped)->GetFunction());
    exports->Set(String::NewFromUtf8(isolate, "enableContext"), FunctionTemplate::New(isolate, enable_context)->GetFunction());
}

NODE_MODULE(wintab, init)

and the errors i'm getting are as follows:

C:\Users\Username\path-to-app\node_modules\wintab-2020\wintab.cc(253,118): error C2660:
'v8::FunctionTemplate::GetFunction': function does not take 0 arguments [path-to-app\node_modules\wintab-2020\build\wintab.vcxproj]
C:\Users\Username\AppData\Local\node-gyp\Cache\12.14.0\include\node\v8.h(5995,46): message : see declaration of 'v8::Funct
ionTemplate::GetFunction' (compiling source file ..\wintab.cc) [C:\Users\Username\path-to-app\node_modules\wintab-2020\build\wintab.vcxproj]
C:\Users\Username\path-to-app\node_modules\wintab-2020\wintab.cc(253,119): error C2661:
'v8::Object::Set': no overloaded function takes 1 arguments [C:\Users\Username\path-to-appnode_modules\wintab-2020\build\wintab.vcxproj]
C:\Users\Username\path-to-app\node_modules\wintab-2020\wintab.cc(254,108): error C2660:
'v8::FunctionTemplate::GetFunction': function does not take 0 arguments [path-to-app\node_modules\wintab-2020\build\wintab.vcxproj]
C:\Users\Username\AppData\Local\node-gyp\Cache\12.14.0\include\node\v8.h(5995,46): message : see declaration of 'v8::Funct
ionTemplate::GetFunction' (compiling source file ..\wintab.cc) [C:\Users\Username\path-to-app\node_modules\wintab-2020\build\wintab.vcxproj]
C:\Users\Username\path-to-app\node_modules\wintab-2020\wintab.cc(254,109): error C2661:
'v8::Object::Set': no overloaded function takes 1 arguments [C:\Users\Username\path-to-appnode_modules\wintab-2020\build\wintab.vcxproj]
C:\Users\Username\path-to-app\node_modules\wintab-2020\wintab.cc(255,108): error C2660:
'v8::FunctionTemplate::GetFunction': function does not take 0 arguments [path-to-app\node_modules\wintab-2020\build\wintab.vcxproj]
C:\Users\Username\AppData\Local\node-gyp\Cache\12.14.0\include\node\v8.h(5995,46): message : see declaration of 'v8::Funct
ionTemplate::GetFunction' (compiling source file ..\wintab.cc) [C:\Users\Username\path-to-app\node_modules\wintab-2020\build\wintab.vcxproj]
C:\Users\Username\path-to-app\node_modules\wintab-2020\wintab.cc(255,109): error C2661:
'v8::Object::Set': no overloaded function takes 1 arguments [C:\Users\Username\path-to-appnode_modules\wintab-2020\build\wintab.vcxproj]
C:\Users\Username\path-to-app\node_modules\wintab-2020\wintab.cc(256,116): error C2660:
'v8::FunctionTemplate::GetFunction': function does not take 0 arguments [path-to-app\node_modules\wintab-2020\build\wintab.vcxproj]
C:\Users\Username\AppData\Local\node-gyp\Cache\12.14.0\include\node\v8.h(5995,46): message : see declaration of 'v8::Funct
ionTemplate::GetFunction' (compiling source file ..\wintab.cc) [C:\Users\Username\path-to-app\node_modules\wintab-2020\build\wintab.vcxproj]
C:\Users\Username\path-to-app\node_modules\wintab-2020\wintab.cc(256,117): error C2661:
'v8::Object::Set': no overloaded function takes 1 arguments [C:\Users\Username\path-to-appnode_modules\wintab-2020\build\wintab.vcxproj]
C:\Users\Username\path-to-app\node_modules\wintab-2020\wintab.cc(257,118): error C2660:
'v8::FunctionTemplate::GetFunction': function does not take 0 arguments [path-to-app\node_modules\wintab-2020\build\wintab.vcxproj]
C:\Users\Username\AppData\Local\node-gyp\Cache\12.14.0\include\node\v8.h(5995,46): message : see declaration of 'v8::Funct
ionTemplate::GetFunction' (compiling source file ..\wintab.cc) [C:\Users\Username\\cadmiu
m-app\node_modules\wintab-2020\build\wintab.vcxproj]
C:\Users\Username\path-to-app\node_modules\wintab-2020\wintab.cc(257,119): error C2661:
'v8::Object::Set': no overloaded function takes 1 arguments [C:\Users\Username\path-to-appnode_modules\wintab-2020\build\wintab.vcxproj]
C:\Users\Username\path-to-app\node_modules\wintab-2020\wintab.cc(258,112): error C2660:
'v8::FunctionTemplate::GetFunction': function does not take 0 arguments [path-to-app\node_modules\wintab-2020\build\wintab.vcxproj]
C:\Users\Username\AppData\Local\node-gyp\Cache\12.14.0\include\node\v8.h(5995,46): message : see declaration of 'v8::Funct
ionTemplate::GetFunction' (compiling source file ..\wintab.cc) [C:\Users\Username\path-to-app\node_modules\wintab-2020\build\wintab.vcxproj]
C:\Users\Username\path-to-app\node_modules\wintab-2020\wintab.cc(258,113): error C2661:
'v8::Object::Set': no overloaded function takes 1 arguments [C:\Users\Username\path-to-appnode_modules\wintab-2020\build\wintab.vcxproj]
C:\Users\Username\path-to-app\node_modules\wintab-2020\wintab.cc(259,123): error C2660:
'v8::FunctionTemplate::GetFunction': function does not take 0 arguments [path-to-app\node_modules\wintab-2020\build\wintab.vcxproj]
C:\Users\Username\AppData\Local\node-gyp\Cache\12.14.0\include\node\v8.h(5995,46): message : see declaration of 'v8::Funct
ionTemplate::GetFunction' (compiling source file ..\wintab.cc) [C:\Users\Username\path-to-app\node_modules\wintab-2020\build\wintab.vcxproj]
C:\Users\Username\path-to-app\node_modules\wintab-2020\wintab.cc(259,124): error C2661:
'v8::Object::Set': no overloaded function takes 1 arguments [C:\Users\Username\path-to-appnode_modules\wintab-2020\build\wintab.vcxproj]
C:\Users\Username\path-to-app\node_modules\wintab-2020\wintab.cc(260,123): error C2660:
'v8::FunctionTemplate::GetFunction': function does not take 0 arguments [path-to-app\node_modules\wintab-2020\build\wintab.vcxproj]
C:\Users\Username\AppData\Local\node-gyp\Cache\12.14.0\include\node\v8.h(5995,46): message : see declaration of 'v8::Funct
ionTemplate::GetFunction' (compiling source file ..\wintab.cc) [C:\Users\Username\path-to-app\node_modules\wintab-2020\build\wintab.vcxproj]
C:\Users\Username\path-to-app\node_modules\wintab-2020\wintab.cc(260,124): error C2661:
'v8::Object::Set': no overloaded function takes 1 arguments [C:\Users\Username\path-to-appnode_modules\wintab-2020\build\wintab.vcxproj]
C:\Users\Username\path-to-app\node_modules\wintab-2020\wintab.cc(261,125): error C2660:
'v8::FunctionTemplate::GetFunction': function does not take 0 arguments [path-to-app\node_modules\wintab-2020\build\wintab.vcxproj]
C:\Users\Username\AppData\Local\node-gyp\Cache\12.14.0\include\node\v8.h(5995,46): message : see declaration of 'v8::Funct
ionTemplate::GetFunction' (compiling source file ..\wintab.cc) [C:\Users\Username\path-to-app\node_modules\wintab-2020\build\wintab.vcxproj]
C:\Users\Username\path-to-app\node_modules\wintab-2020\wintab.cc(261,126): error C2661:
'v8::Object::Set': no overloaded function takes 1 arguments [C:\Users\Username\path-to-appnode_modules\wintab-2020\build\wintab.vcxproj]
C:\Users\Username\path-to-app\node_modules\wintab-2020\wintab.cc(262,125): error C2660:
'v8::FunctionTemplate::GetFunction': function does not take 0 arguments [path-to-app\node_modules\wintab-2020\build\wintab.vcxproj]
C:\Users\Username\AppData\Local\node-gyp\Cache\12.14.0\include\node\v8.h(5995,46): message : see declaration of 'v8::Funct
ionTemplate::GetFunction' (compiling source file ..\wintab.cc) [C:\Users\Username\path-to-app\node_modules\wintab-2020\build\wintab.vcxproj]
C:\Users\Username\path-to-app\node_modules\wintab-2020\wintab.cc(262,126): error C2661:
'v8::Object::Set': no overloaded function takes 1 arguments [C:\Users\Username\path-to-appnode_modules\wintab-2020\build\wintab.vcxproj]
C:\Users\Username\path-to-app\node_modules\wintab-2020\wintab.cc(263,125): error C2660:
'v8::FunctionTemplate::GetFunction': function does not take 0 arguments [path-to-app\node_modules\wintab-2020\build\wintab.vcxproj]
C:\Users\Username\AppData\Local\node-gyp\Cache\12.14.0\include\node\v8.h(5995,46): message : see declaration of 'v8::Funct
ionTemplate::GetFunction' (compiling source file ..\wintab.cc) [C:\Users\Username\path-to-app\node_modules\wintab-2020\build\wintab.vcxproj]
C:\Users\Username\path-to-app\node_modules\wintab-2020\wintab.cc(263,126): error C2661:
'v8::Object::Set': no overloaded function takes 1 arguments [C:\Users\Username\path-to-appnode_modules\wintab-2020\build\wintab.vcxproj]
C:\Users\Username\path-to-app\node_modules\wintab-2020\wintab.cc(264,125): error C2660:
'v8::FunctionTemplate::GetFunction': function does not take 0 arguments [path-to-app\node_modules\wintab-2020\build\wintab.vcxproj]
C:\Users\Username\AppData\Local\node-gyp\Cache\12.14.0\include\node\v8.h(5995,46): message : see declaration of 'v8::Funct
ionTemplate::GetFunction' (compiling source file ..\wintab.cc) [C:\Users\Username\path-to-app\node_modules\wintab-2020\build\wintab.vcxproj]
C:\Users\Username\path-to-app\node_modules\wintab-2020\wintab.cc(264,126): error C2661:
'v8::Object::Set': no overloaded function takes 1 arguments [C:\Users\Username\path-to-appnode_modules\wintab-2020\build\wintab.vcxproj]
C:\Users\Username\path-to-app\node_modules\wintab-2020\wintab.cc(265,118): error C2660:
'v8::FunctionTemplate::GetFunction': function does not take 0 arguments [path-to-app\node_modules\wintab-2020\build\wintab.vcxproj]
C:\Users\Username\AppData\Local\node-gyp\Cache\12.14.0\include\node\v8.h(5995,46): message : see declaration of 'v8::Funct
ionTemplate::GetFunction' (compiling source file ..\wintab.cc) [C:\Users\Username\path-to-app\node_modules\wintab-2020\build\wintab.vcxproj]
C:\Users\Username\path-to-app\node_modules\wintab-2020\wintab.cc(265,119): error C2661:
'v8::Object::Set': no overloaded function takes 1 arguments [C:\Users\Username\path-to-appnode_modules\wintab-2020\build\wintab.vcxproj]
C:\Users\Username\path-to-app\node_modules\wintab-2020\wintab.cc(266,121): error C2660:
'v8::FunctionTemplate::GetFunction': function does not take 0 arguments [path-to-app\node_modules\wintab-2020\build\wintab.vcxproj]
C:\Users\Username\AppData\Local\node-gyp\Cache\12.14.0\include\node\v8.h(5995,46): message : see declaration of 'v8::Funct
ionTemplate::GetFunction' (compiling source file ..\wintab.cc) [C:\Users\Username\path-to-app\node_modules\wintab-2020\build\wintab.vcxproj]
C:\Users\Username\path-to-app\node_modules\wintab-2020\wintab.cc(266,122): error C2661:
'v8::Object::Set': no overloaded function takes 1 arguments [C:\Users\Username\path-to-appnode_modules\wintab-2020\build\wintab.vcxproj]
C:\Users\Username\path-to-app\node_modules\wintab-2020\wintab.cc(267,129): error C2660:
'v8::FunctionTemplate::GetFunction': function does not take 0 arguments [path-to-app\node_modules\wintab-2020\build\wintab.vcxproj]
C:\Users\Username\AppData\Local\node-gyp\Cache\12.14.0\include\node\v8.h(5995,46): message : see declaration of 'v8::Funct
ionTemplate::GetFunction' (compiling source file ..\wintab.cc) [C:\Users\Username\path-to-app\node_modules\wintab-2020\build\wintab.vcxproj]
C:\Users\Username\path-to-app\node_modules\wintab-2020\wintab.cc(267,130): error C2661:
'v8::Object::Set': no overloaded function takes 1 arguments [C:\Users\Username\path-to-appnode_modules\wintab-2020\build\wintab.vcxproj]
C:\Users\Username\path-to-app\node_modules\wintab-2020\wintab.cc(268,125): error C2660:
'v8::FunctionTemplate::GetFunction': function does not take 0 arguments [path-to-app\node_modules\wintab-2020\build\wintab.vcxproj]
C:\Users\Username\AppData\Local\node-gyp\Cache\12.14.0\include\node\v8.h(5995,46): message : see declaration of 'v8::Funct
ionTemplate::GetFunction' (compiling source file ..\wintab.cc) [C:\Users\Username\path-to-app\node_modules\wintab-2020\build\wintab.vcxproj]
C:\Users\Username\path-to-app\node_modules\wintab-2020\wintab.cc(268,126): error C2661:
'v8::Object::Set': no overloaded function takes 1 arguments [C:\Users\Username\path-to-appnode_modules\wintab-2020\build\wintab.vcxproj]
  • The error messages appear to be self-explanatory. What specifically don't you understand, about them? – Sam Varshavchik Apr 09 '20 at 15:21
  • To be completely candid, I don't really know much C at all, and don't understand the syntax of the lines in question. – Nick Boyajian Apr 09 '20 at 15:23
  • How were you planning, then, on fixing the compilation errors, if you don't "really know much C"? Yes, there are compilation errors. Your description says that you're compiling older versions of a software against newer libraries. It should not be surprising that this fails, because the library has changed and its APIs have changed. So the code being compiled needs changing, too. You need to know and understand C to do that. – Sam Varshavchik Apr 09 '20 at 15:31
  • The project i'm working on is in JS, and unfortunately i've run into a situation where the app needs to communicate with some legacy windows apis that can only be talked to with C. Once these errors are addressed and this module is working, I can continue on in the language I know. I was just hoping the stackoverflow community could help me out. – Nick Boyajian Apr 09 '20 at 15:38
  • There's nothing really to figure out here. The functions being called are now taking/using different parameters. Your compiler is reporting that. To figure out the fix, must look at the code that's calling the functions, understand what it's trying to do, then go and pull up those functions, read the documentation of their parameters, understand what that function does, and figure out what needs to be changed in order to call the function correctly. Or, maybe a different function needs to be called. That's it. – Sam Varshavchik Apr 09 '20 at 15:45
  • it's the lines that look like this: exports->Set(String::NewFromUtf8(isolate, "pressure"), FunctionTemplate::New(isolate, get_pressure)->GetFunction()); .... the documentation says that GetFunction needs to context passed into it but i'm not sure what that means per my file... – Nick Boyajian Apr 09 '20 at 16:27
  • No matter what they look like, it is very unlikely that C code can be completely understood by looking at only one line of it. This is somewhat along the lines of being able to fully understand how an automobile works by looking only at one of its wheels. – Sam Varshavchik Apr 09 '20 at 16:30
  • Understood, which is why i posted the whole file above. Feel free to stop responding if you don't want to help me, but I really would appreciate guidance from anyone here. – Nick Boyajian Apr 09 '20 at 16:32

1 Answers1

0

Previous node.js versions was maintaining these APIs but these were all marked deprecated. In node.js v12 they have removed these deprecated APIs.

Now the v8::FunctionTemplate::GetFunction() takes one argument which is context. And also previously GetFunction used to return Local Local<Function> GetFunction() and now it returns MaybeLocal MaybeLocal<Function> GetFunction (Local<Context> context) so we have to convert this MaybeLocal to Local using .ToLocalChecked() :

So, you can update your GetFunction() with below piece of code : v8::FunctionTemplate::GetFunction(Nan::GetCurrentContext()).ToLocalChecked()

You can refer this document for other issues as well for Node 12 https://v8docs.nodesource.com/node-12.16/d2/dc3/namespacev8.html

Dharman
  • 30,962
  • 25
  • 85
  • 135
Anjs
  • 586
  • 4
  • 11