So... I'm still struggling with the Webview wrapper for Nim (very, _very_ close 
to get it right; but a couple of issues still popping up)

So...

**Important Note:** I'm compiling as C++ with VCC/cl.exe. (the exact same thing 
compiles fine & works flawlessly for Clang/macOS & GCC/Linux)

Here's my type definition (at least the relevant ones):
    
    
    type
         Webview* {.importc: "webview_t".} = pointer
         WebviewCallback* = proc (seq: cstring, req: cstring, arg: pointer) 
{.cdecl.}
    
    
    Run

Here's the function import:
    
    
    proc webview_bind*(w: Webview, name: cstring, cb: WebviewCallback, arg: 
pointer) {.importc.}
    
    
    Run

Here's how the exact same thing is declared in _webview.h_ (C/C++):
    
    
    WEBVIEW_API void webview_bind(webview_t w, const char *name,
                                  void (*fn)(const char *seq, const char *req,
                                             void *arg),
                                  void *arg);
    
    
    Run

And here's the error code I'm getting (from the CI build, since I don't have a 
Windows machine):
    
    
    @mhelp...@swebviews.nim.cpp
    D:\a\arturo\arturo\.cache\@mhelp...@swebviews.nim.cpp(1286): error C2664: 
'void webview_bind(webview_t,const char *,void (__cdecl *)(const char *,const 
char *,void *),void *)': cannot convert argument 3 from 
'tyProc__6j8G629bS5b9a9a48K9cMq8U9aA' to 'void (__cdecl *)(const char *,const 
char *,void *)'
    D:\a\arturo\arturo\.cache\@mhelp...@swebviews.nim.cpp(1286): note: This 
conversion requires a reinterpret_cast, a C-style cast or parenthesized 
function-style cast
    D:\a\arturo\arturo\src\extras\webview/webview.h(98): note: see declaration 
of 'webview_bind'
    
    
    Run

If you ask me (and Clang/GCC), I'm already doing right - and the correspondence 
between the argument definitions is correct. If you ask VCC/cl, it seems to... 
disagree.

Any ideas?

Reply via email to