Updated Playing with CPP VTABLE from Nim (markdown)
This commit is contained in:
parent
35bd8f293b
commit
059ca01e77
|
@ -3,9 +3,9 @@ Imagine you are trying to communicate with a C++ app from Nim, and the C++ inter
|
|||
### Case example, notepad++ plugin:
|
||||
notepad++ plugin is a normal dll with normal interface. Standard notepad++ plugin requires standard cdecl calling convention for it's binary interface, not a big problem, Nim ffi can handle that perfectly. But things get more interesting when we want to make an external lexer for notepad++ editor engine: Scintilla.
|
||||
|
||||
Although that external lexer we want to create must also be reside in the same dll with our notepad++ plugin, it has different calling convention, scintilla requires stdcall calling convention for all functions it needed. Again, this is not a problem for Nim, just use {.stdcall.} pragma. But there is another requirement for notepad++ plugin: all exported function name must not be decorated ala normal stdcall, so we need to activate -Wl,--kill-at switch when compile the plugin project, and the C/C++ compiler will handle that.
|
||||
Although that external lexer we want to create must also be reside in the same dll with our notepad++ plugin, it has different calling convention, scintilla requires stdcall calling convention for all functions it needed. Again, this is not a problem for Nim, just use {.stdcall.} pragma. But there is another requirement for notepad++ plugin: all exported function name must not be decorated ala normal stdcall, so we need to activate `-Wl,--kill-at` switch when compile the plugin project, and the C/C++ compiler will handle that.
|
||||
|
||||
OK, so far no C++ feature we already met. But wait, that's not the real interface to Scintilla, it's only entry point for a more complicated interface.
|
||||
OK, so far no C++ features we already met. But wait, that's not the real interface to Scintilla, it's only entry point for a more complicated interface.
|
||||
|
||||
### The C++ interface
|
||||
```C++
|
||||
|
|
Loading…
Reference in New Issue