Closed Akuli closed 9 months ago
I want:
if WINDOWS: declare GetModuleFileNameA(hModule: void*, lpFilename: byte*, nSize: int) -> int elif MACOS: declare _NSGetExecutablePath(buf: byte*, bufsize: int*) -> int else: declare readlink(linkpath: byte*, result: byte*, result_size: long) -> long def find_current_executable() -> byte*: if WINDOWS: # use GetModuleFileNameA() elif MACOS: # use _NSGetExecutablePath() else: # use readlink()
There is currently no good way to write platform-specific code, and I have ended up with some amusing workarounds:
https://github.com/Akuli/jou/blob/914200d20bfbcd17d660c18689ac2f910a94c2da/src/codegen.c#L189-L196
Previously mentioned in https://github.com/Akuli/jou/issues/383#issuecomment-1500832302
I want:
There is currently no good way to write platform-specific code, and I have ended up with some amusing workarounds:
https://github.com/Akuli/jou/blob/914200d20bfbcd17d660c18689ac2f910a94c2da/src/codegen.c#L189-L196
Previously mentioned in https://github.com/Akuli/jou/issues/383#issuecomment-1500832302