lots of C++ codegen improvements
This commit is contained in:
parent
d020ad097c
commit
e84834db79
10 changed files with 71 additions and 119 deletions
|
|
@ -84,16 +84,18 @@ elif defined(windows) or defined(dos):
|
|||
type
|
||||
THINSTANCE {.importc: "HINSTANCE".} = object
|
||||
x: pointer
|
||||
proc getProcAddress(lib: THINSTANCE, name: cstring): TProcAddr {.
|
||||
importcpp: "(void*)GetProcAddress(@)", header: "<windows.h>", stdcall.}
|
||||
else:
|
||||
type
|
||||
THINSTANCE {.importc: "HINSTANCE".} = pointer
|
||||
proc getProcAddress(lib: THINSTANCE, name: cstring): TProcAddr {.
|
||||
importc: "GetProcAddress", header: "<windows.h>", stdcall.}
|
||||
|
||||
proc freeLibrary(lib: THINSTANCE) {.
|
||||
importc: "FreeLibrary", header: "<windows.h>", stdcall.}
|
||||
proc winLoadLibrary(path: cstring): THINSTANCE {.
|
||||
importc: "LoadLibraryA", header: "<windows.h>", stdcall.}
|
||||
proc getProcAddress(lib: THINSTANCE, name: cstring): TProcAddr {.
|
||||
importc: "GetProcAddress", header: "<windows.h>", stdcall.}
|
||||
|
||||
proc nimUnloadLibrary(lib: TLibHandle) =
|
||||
freeLibrary(cast[THINSTANCE](lib))
|
||||
|
|
|
|||
|
|
@ -183,11 +183,17 @@ proc rawEchoNL() {.inline, compilerproc.} = write(stdout, "\n")
|
|||
when (defined(windows) and not defined(useWinAnsi)) or defined(nimdoc):
|
||||
include "system/widestrs"
|
||||
|
||||
when defined(windows) and not defined(useWinAnsi):
|
||||
proc wfopen(filename, mode: WideCString): pointer {.
|
||||
importc: "_wfopen", nodecl.}
|
||||
proc wfreopen(filename, mode: WideCString, stream: File): File {.
|
||||
importc: "_wfreopen", nodecl.}
|
||||
when defined(windows) and not defined(useWinAnsi):
|
||||
when defined(cpp):
|
||||
proc wfopen(filename, mode: WideCString): pointer {.
|
||||
importcpp: "_wfopen((const wchar_t*)#, (const wchar_t*)#)", nodecl.}
|
||||
proc wfreopen(filename, mode: WideCString, stream: File): File {.
|
||||
importc: "_wfreopen((const wchar_t*)#, (const wchar_t*)#)", nodecl.}
|
||||
else:
|
||||
proc wfopen(filename, mode: WideCString): pointer {.
|
||||
importc: "_wfopen", nodecl.}
|
||||
proc wfreopen(filename, mode: WideCString, stream: File): File {.
|
||||
importc: "_wfreopen", nodecl.}
|
||||
|
||||
proc fopen(filename, mode: cstring): pointer =
|
||||
var f = newWideCString(filename)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue