00:16:20 | * | cm_ joined #nim |
00:17:11 | * | cm quit (Ping timeout: 252 seconds) |
00:17:11 | * | cm_ is now known as cm |
00:55:52 | * | amadaluzia quit (Quit: ZNC 1.9.1 - https://znc.in) |
01:04:31 | * | rockcavera joined #nim |
02:13:39 | * | beholders_eye quit (Ping timeout: 260 seconds) |
03:18:14 | * | fallback quit (Ping timeout: 260 seconds) |
06:15:55 | * | xet7 quit (Remote host closed the connection) |
06:17:32 | * | xet7 joined #nim |
06:21:45 | * | xet7 quit (Read error: Connection reset by peer) |
06:23:15 | * | xet7 joined #nim |
06:27:04 | * | xet7 quit (Remote host closed the connection) |
06:30:19 | * | xet7 joined #nim |
06:31:15 | * | xet7 quit (Remote host closed the connection) |
07:47:05 | * | pmp-p joined #nim |
08:20:24 | * | nils` quit (Ping timeout: 260 seconds) |
08:24:29 | * | przmk40 joined #nim |
08:25:37 | * | om3ga_ joined #nim |
08:25:40 | * | Lord_Nightmare2 joined #nim |
08:27:15 | * | pmp-p_ joined #nim |
08:27:16 | * | pmp-p quit (Killed (NickServ (GHOST command used by pmp-p_))) |
08:27:48 | * | om3ga quit (Ping timeout: 260 seconds) |
08:27:48 | * | Jjp137 quit (Ping timeout: 260 seconds) |
08:27:49 | * | cm quit (Ping timeout: 260 seconds) |
08:27:50 | * | Lord_Nightmare quit (Ping timeout: 260 seconds) |
08:27:50 | * | mahlon quit (Ping timeout: 260 seconds) |
08:27:51 | * | shrikant quit (Ping timeout: 260 seconds) |
08:27:51 | * | redj quit (Ping timeout: 260 seconds) |
08:27:51 | * | przmk4 quit (Ping timeout: 260 seconds) |
08:27:52 | * | mahlon joined #nim |
08:27:52 | * | przmk40 is now known as przmk4 |
08:28:02 | * | Lord_Nightmare2 is now known as Lord_Nightmare |
08:28:22 | * | redj joined #nim |
08:28:24 | * | shrikant joined #nim |
08:29:36 | * | cm joined #nim |
09:00:30 | * | mahlon quit (Ping timeout: 260 seconds) |
09:00:50 | * | mahlon joined #nim |
09:06:02 | * | nils` joined #nim |
09:42:07 | * | przmk48 joined #nim |
09:43:59 | * | przmk4 quit (Ping timeout: 260 seconds) |
09:44:00 | * | przmk48 is now known as przmk4 |
09:53:15 | * | przmk4 quit (Quit: The Lounge - https://thelounge.chat) |
09:55:55 | * | przmk4 joined #nim |
10:21:27 | * | przmk4 quit (Quit: Ping timeout (120 seconds)) |
10:21:48 | * | przmk4 joined #nim |
10:34:53 | * | Jjp137 joined #nim |
11:47:07 | FromDiscord | <madonuko> nim scripts are kinda brokey |
11:47:18 | * | fabricio joined #nim |
11:47:56 | fabricio | what's up with concurrency libs going for the async/await route instead of golang style csp or perhaps even erlang style actors? |
12:13:26 | * | jjido joined #nim |
12:29:42 | * | przmk42 joined #nim |
12:31:15 | * | przmk4 quit (Ping timeout: 252 seconds) |
12:31:15 | * | przmk42 is now known as przmk4 |
12:44:27 | * | fabricio quit (Ping timeout: 252 seconds) |
12:59:24 | * | pmp-p_ quit (Ping timeout: 260 seconds) |
13:35:19 | * | Guest32 joined #nim |
13:39:28 | Guest32 | Hey hey, noobish question here about C interop. |
13:39:29 | Guest32 | I'm using libgccjit from Nim, with simple importc bindings. Nim's been great so far! |
13:39:29 | Guest32 | All is well until I actually try and call my generated code. |
13:39:30 | Guest32 | libgccjit has a function called `gcc_jit_result_get_code`: |
13:39:30 | Guest32 | ``` |
13:39:31 | Guest32 | This will need to be cast to a function pointer of the |
13:39:32 | Guest32 | correct type before it can be called. */ |
13:39:32 | Guest32 | extern void * |
13:39:33 | Guest32 | gcc_jit_result_get_code (gcc_jit_result *result, |
13:39:33 | Guest32 | const char *funcname); |
13:39:34 | Guest32 | ``` |
13:39:34 | Guest32 | I seem to get a reasonable looking pointer back. How do I cast this to something I can pass arguments to from Nim? (If calling conventions are annoying, I'd be happy to settle for not being able to pass arguments.) |
13:41:25 | Guest32 | I've tried every variety of cast I can to invoke this function pointer, and sadly the docs didn't have much to say about this case (dynamically generated code -- just calling a function pointer created at runtime) |
13:51:33 | Guest32 | (for future readers who also just need 'a hacky thing to make this work') |
13:51:34 | Guest32 | I made an `invoke_trampoline.c` file that just does this job on Nim's behalf: |
13:51:34 | Guest32 | ``` |
13:51:35 | Guest32 | void invoke_trampoline(void* fp, int argc, char** argv) { |
13:51:35 | Guest32 | int (*fp2)(int, char**) = fp; |
13:51:36 | Guest32 | fp2(argc, argv); |
13:51:36 | Guest32 | } |
13:51:37 | Guest32 | ``` |
13:51:37 | Guest32 | And then simply pull this in from Nim usage code: |
13:51:38 | Guest32 | ``` |
13:51:38 | Guest32 | {.compile: "invoke_trampoline.c".} |
13:51:39 | Guest32 | proc invokeTrampoline(fp: pointer, argc: cint, argv: ptr ptr char): void {.cdecl, importc: "invoke_trampoline".} |
13:51:39 | Guest32 | ``` |
14:03:20 | * | amadaluzia joined #nim |
14:04:46 | * | amadaluzia quit (Client Quit) |
14:06:06 | * | amadaluzia joined #nim |
14:14:07 | * | przmk4 quit (Quit: The Lounge - https://thelounge.chat) |
14:14:33 | * | przmk4 joined #nim |
14:26:52 | * | fabricio joined #nim |
14:30:01 | * | beholders_eye joined #nim |
15:18:25 | * | ntat joined #nim |
15:20:34 | * | przmk44 joined #nim |
15:20:37 | * | przmk4 quit (Read error: Connection reset by peer) |
15:20:37 | * | przmk44 is now known as przmk4 |
15:21:18 | * | przmk4 quit (Client Quit) |
15:21:46 | * | przmk4 joined #nim |
15:31:54 | * | rez joined #nim |
15:35:44 | * | rez quit (Client Quit) |
16:34:04 | * | andy-turner joined #nim |
16:44:34 | * | andy-turner quit (Quit: Leaving) |
16:44:52 | * | andy-turner joined #nim |
17:07:37 | * | jjido quit (Quit: My laptop has gone to sleep. ZZZzzz…) |
17:14:34 | * | ntat quit (Quit: leaving) |
17:29:13 | * | Guest32 quit (Ping timeout: 272 seconds) |
17:30:23 | * | skippy8 joined #nim |
17:52:57 | * | jjido joined #nim |
17:53:21 | * | fabricio quit (Ping timeout: 248 seconds) |
18:11:17 | * | amadaluzia quit (Quit: ZNC 1.9.1 - https://znc.in) |
18:15:03 | * | beholders_eye quit (Quit: WeeChat 4.6.3) |
18:24:05 | * | beholders_eye joined #nim |
18:35:24 | * | fabricio joined #nim |
19:13:28 | * | jjido quit (Quit: My laptop has gone to sleep. ZZZzzz…) |
19:26:08 | * | andy-turner quit (Read error: Connection reset by peer) |
19:32:59 | * | fabricio quit (Ping timeout: 260 seconds) |
19:34:39 | * | fabricio joined #nim |
20:39:29 | * | fabricio quit (Ping timeout: 260 seconds) |
20:41:02 | * | fabricio joined #nim |
20:45:18 | * | fallback joined #nim |
21:12:34 | * | fabricio quit (Ping timeout: 276 seconds) |
21:14:14 | * | fabricio joined #nim |
21:19:57 | FromDiscord | <godalming123> sent a code paste, see https://play.nim-lang.org/#pasty=fZLDqCLx |
21:30:15 | FromDiscord | <Elegantbeef> `discard` |
21:31:18 | * | skippy8 quit (Quit: WeeChat 4.6.3) |
22:01:55 | * | rez joined #nim |
23:49:34 | * | fabricio quit (Quit: WeeChat 3.5) |