00:04:00 | * | Matthias247 quit (Read error: Connection reset by peer) |
00:25:28 | * | Demos joined #nim |
00:34:14 | * | jaco60 quit (Ping timeout: 244 seconds) |
00:35:24 | * | Demos quit (Remote host closed the connection) |
01:12:58 | * | Demos joined #nim |
01:20:42 | * | brson quit (Ping timeout: 246 seconds) |
01:22:31 | * | brson joined #nim |
01:31:04 | * | askatasuna joined #nim |
01:37:53 | * | Demos quit (Remote host closed the connection) |
01:38:52 | * | Demos joined #nim |
01:49:03 | * | Demos quit (Remote host closed the connection) |
01:52:39 | * | Demos joined #nim |
01:56:01 | * | pregressive quit (Remote host closed the connection) |
02:02:35 | * | Demos quit (Remote host closed the connection) |
02:03:22 | * | Demos joined #nim |
02:09:23 | * | zaquest quit (Ping timeout: 256 seconds) |
02:09:56 | * | zaquest joined #nim |
02:12:37 | * | xificurC quit (Remote host closed the connection) |
02:13:18 | * | Demos quit (Remote host closed the connection) |
02:13:18 | * | xificurC joined #nim |
02:26:10 | * | brson quit (Quit: leaving) |
02:30:19 | * | strcmp1 joined #nim |
02:44:12 | * | vendethiel quit (Ping timeout: 264 seconds) |
02:57:52 | * | Demos joined #nim |
03:01:00 | * | EXetoC quit (Ping timeout: 264 seconds) |
03:07:54 | * | Demos quit (Remote host closed the connection) |
03:54:44 | * | darkf joined #nim |
04:30:59 | * | Demos joined #nim |
04:35:26 | * | Demos quit (Ping timeout: 248 seconds) |
05:15:48 | * | punctuated joined #nim |
05:15:58 | * | punctuated left #nim ("Leaving") |
05:38:21 | * | Kingsquee joined #nim |
06:30:39 | * | pregressive joined #nim |
06:40:54 | * | pregressive quit (Remote host closed the connection) |
06:46:33 | * | vendethiel joined #nim |
06:48:06 | * | filcuc joined #nim |
07:08:52 | * | unclechu joined #nim |
07:09:02 | * | vendethiel quit (Ping timeout: 256 seconds) |
07:10:11 | reactormonk | Araq, so how wold you code https://gist.github.com/7d98634df14d663d331f without Option? |
07:36:58 | * | vendethiel joined #nim |
08:01:57 | * | gmpreussner|work quit (Read error: Connection reset by peer) |
08:14:41 | * | Kingsquee quit (Quit: Konversation terminated!) |
08:14:50 | * | Kingsquee joined #nim |
08:19:14 | * | vendethiel quit (Ping timeout: 244 seconds) |
08:29:04 | * | vendethiel joined #nim |
08:55:36 | * | xcombelle joined #nim |
09:37:18 | * | xcombelle quit (Ping timeout: 264 seconds) |
09:40:31 | * | Varriount|Mobile joined #nim |
09:43:17 | * | BitPuffin|osx quit (Ping timeout: 256 seconds) |
09:46:15 | * | boopisaway is now known as boop |
09:46:37 | * | Matthias247 joined #nim |
09:50:04 | * | bjz quit (Quit: My MacBook Pro has gone to sleep. ZZZzzz…) |
09:50:26 | * | bjz joined #nim |
09:57:22 | * | xcombelle joined #nim |
10:07:33 | * | Varriount|Mobile quit (Quit: AndroIRC - Android IRC Client ( http://www.androirc.com )) |
10:32:51 | * | filcuc quit (Quit: Konversation terminated!) |
10:46:36 | * | jaco60 joined #nim |
10:52:51 | * | EXetoC joined #nim |
11:01:03 | * | Gertm joined #nim |
11:02:58 | * | Gertm left #nim (#nim) |
11:10:17 | * | drewsrem joined #nim |
11:10:35 | drewsrem | Somehow I got the impression that sequences are always allocated on the heap, can someone quickly tell me I'm wrong? |
11:17:09 | * | b_ joined #nim |
11:45:18 | * | xcombelle quit (Remote host closed the connection) |
12:14:21 | federico3 | we can't send direct messages between forum users - can we? |
12:14:45 | reactormonk | drewsrem, nope, you are correct. For the stack, go with arrays |
12:15:02 | reactormonk | drewsrem, there's probably a way to have sequences on the stack too, but not sure if that will work |
12:15:13 | reactormonk | federico3, nah, that's what IRC is for |
12:15:37 | federico3 | reactormonk: many users are not here |
12:17:03 | reactormonk | federico3, hm, true. Well, poke dom96 for forum features. |
12:19:45 | drewsrem | reactormonk, I'm essentially trying to have an object which has a buffer which can start at arbitrary length in the type-system, the length is never changed once initialized and is determined at compile-time via macros, any pointers? |
12:20:04 | drewsrem | And ofc. I'd like to do this on the stack |
12:20:06 | reactormonk | drewsrem, via generic? |
12:20:30 | drewsrem | reactormonk, wouldn't that create multiple incompatible object-types, one for every buffer-length? |
12:20:40 | reactormonk | drewsrem, pretty much... oops |
12:21:00 | reactormonk | drewsrem, you'd have to write everything via [T, S] for combining two |
12:21:22 | drewsrem | reactormonk, I'm not following you, is this viable? |
12:21:47 | reactormonk | drewsrem, should be, just remember that you'll have to write every proc that takes two objects to also have two generics |
12:22:16 | reactormonk | two arrays of a different size are a different type, no fucking around with that - you could also use unbounded arrays, but I don't like that. Just go with generics. |
12:23:43 | drewsrem | unbounded arrays? - how'd I allocate those on the stack? |
12:24:06 | reactormonk | err, don't go that route. It's perfectly possible to do this with generics. |
12:24:53 | drewsrem | Just curious because I tried to do it, I think, but didn't figured out how I'd actually do it |
12:25:17 | drewsrem | i've seen UncheckedArray in lib/pure/collections/rtarrays - if that's along those lines |
12:26:30 | arnetheduck | hello.. how much memory does a seq[char] use? ie if I do newSeq[char](1024*1024), how much memory will nim consume for that? |
12:27:53 | reactormonk | arnetheduck, shouldn't be any significant overhead, just try it |
12:27:56 | drewsrem | arnetheduck, var foo = newSeq[char](1024*1024); echo sizeof(foo) |
12:28:19 | drewsrem | or maybe I'm wrong |
12:31:23 | arnetheduck | I'm looking at the generated code, and it goes something like "mulInt(len, (*(*typ).base).size)", and then "newObj(typ, size);".. looking at the size member for the type passed to newSeq, it says "NTI92006.size = sizeof(TY92006*);", so 8 on a 64-bit machine.. |
12:32:18 | arnetheduck | that would mean that it takes 8 bytes for every character which seems fishy, so I'm wondering if I'm reading it wrong |
12:32:37 | * | EXetoC quit (Quit: WeeChat 1.2) |
12:34:11 | drewsrem | reactormonk, you mean like this: http://ix.io/jPk ? |
12:34:22 | reactormonk | drewsrem, pretty much |
12:34:35 | reactormonk | drewsrem, you might even use T in the array size |
12:34:47 | drewsrem | I tried that, probably did something wrong |
12:34:49 | drewsrem | sec |
12:34:57 | reactormonk | or create a macro which creates you the type where you only have to pass the macro size |
12:36:51 | drewsrem | reactormonk, http://ix.io/jPn ? |
12:37:10 | reactormonk | drewsrem, yeah, figured. just go with the above and a template |
12:37:24 | drewsrem | reactormonk, kk, thanks |
12:37:54 | drewsrem | The overhead of generics is code-generation right? |
12:38:08 | drewsrem | Size that is |
12:38:10 | reactormonk | basically template makeFoo(size: int): Foo = Foo[array[size, int]]() |
12:38:40 | * | Trustable joined #nim |
12:41:27 | drewsrem | So if I then makeFoo 1000 different object with different sizes, there'd be no significant overhead? |
12:41:42 | drewsrem | "significant overhead" |
12:41:52 | drewsrem | Just wondering how well this might scale |
12:45:02 | * | vendethiel quit (Quit: q+) |
12:46:44 | arnetheduck | ah no.. got it.. it looks at the size of base, not of the sequence pointer, so 1.. sorry for the noise |
12:47:02 | arnetheduck | everything as expected, just a little overhead for the gc |
12:53:03 | drewsrem | reactormonk, can you nontheless point me to something I can read that'd help me how to implement unbounded arrays allocated on the stack? |
12:53:40 | reactormonk | drewsrem, I have no idea, because I'd never use them. I've just read about it here on the channel. Maybe find the logger bot and go search the history. |
12:53:47 | drewsrem | reactormonk, thanks |
12:54:04 | reactormonk | drewsrem, might even be something in the documentation. |
12:57:39 | * | wirbi joined #nim |
12:57:49 | wirbi | Hello! |
12:59:20 | wirbi | Is in the nim a way to pop first value of a sequence? Like python foo.pop(0) |
13:01:55 | wirbi | And some slice method like python foo[1:] (from 1 to end), foo[2:-2] (frome 2 to 2 before end) |
13:02:40 | wirbi | And python enumerate analog? |
13:15:26 | reactormonk | enumerate <-> iterable maybe? |
13:15:49 | reactormonk | anf slicing foo[1.. ^1] etc. ^1 is evaluated at compiletime. |
13:17:31 | reactormonk | wirbi, and yes, there's pop. |
13:22:57 | wirbi | For "pop" question: |
13:23:04 | wirbi | var a: seq[int] = @[1, 2, 3] |
13:23:09 | wirbi | var b = a.pop() |
13:23:16 | wirbi | echo b, " ", a |
13:23:35 | wirbi | Result: 3 @[1, 2] |
13:24:06 | wirbi | How can I get result like: 1 @[2, 3] |
13:24:53 | wirbi | (b=1 and a=@[2, 3]) |
13:26:00 | reactormonk | btw, no need for the seq[int] part, the compile should be able to figure that out |
13:26:27 | reactormonk | ah, you wanna shift |
13:26:35 | * | vendethiel joined #nim |
13:28:23 | reactormonk | wirbi, proc shift[T](x: var seq[T], where: Natural = 0): T =\n result = x[where]\n x.delete(where) |
13:30:13 | wirbi | Cool! ) Thank you! |
13:37:11 | * | BitPuffin|osx joined #nim |
13:51:02 | drewsrem | Is there something to declare an "order" in which macros are executed? - e.g. foo is a macro takes a strLit and saves it in a compileTime variable, bar is a macro that runs through this variable and echoes their content at compileTime - now the behavior I want is that the expansion/execution of foo macros are "immediate", but the expansion/execution of bar macros only happen after all code has been read and all the found foo-macros have been executed. - |
13:51:02 | drewsrem | Does this make any sense? |
14:05:14 | reactormonk | it should move along data dependencies - and that sounds kinda like global vars |
14:06:37 | drewsrem | reactormonk, yeah it would store the stringLits in a global compileTime var |
14:06:52 | drewsrem | reactormonk, or just in an unexported macro-scope |
14:07:12 | drewsrem | but any idea how I'd postpone bar-macro-calls until all foo-macro-calls have been executed? |
14:07:13 | reactormonk | drewsrem, I dislike global vars, and so should you :-P Gimme code |
14:07:26 | drewsrem | reactormonk, sec |
14:11:44 | drewsrem | http://ix.io/jPv |
14:12:28 | drewsrem | So it's like, two-pass, one pass, expand all foos, second pass, expand all bars |
14:12:30 | reactormonk | what do you need the global collection of strings for? |
14:12:53 | reactormonk | I'm not totally sure the compiler can do that... But Araq might expand on that |
14:13:07 | renesac | wirbi: by enumerate analog you mean getting the index and the element in an iteration? |
14:13:55 | renesac | that is pairs, and is automatically called if you do "for i, e in somethingIterable:" |
14:18:49 | drewsrem | reactormonk, I'm essentially trying to buffer API-calls, think compiling regex-expressions, but if you use the same regex-expression-string more then once it will use the buffered version, instead of storing those in a CritBitTree or HashSet or something and be indexed by the string itself, they're simply stored in an array and the strings are mapped to compiletime to just int-indexes for that array, the array is then simply initialized in one go, the |
14:18:49 | drewsrem | bar macro |
14:19:30 | drewsrem | reactormonk, maybe that's the wrong approach, but was the best idea that come to my mind |
14:20:46 | drewsrem | So essentially re"foo.bar" is a macro re that returns the same int, e.g. 0, re"bar" is a new expr and the macro returns 1 etc. |
14:26:05 | wirbi | renesac, thank you, it's work |
14:26:47 | renesac | also: https://github.com/nim-lang/Nim/wiki/Nim-for-Python-Programmers <-- this needs to be expanded |
14:27:33 | federico3 | renesac: volunteers are welcome |
14:27:47 | renesac | yeah |
14:28:20 | federico3 | You can put some todos in |
14:31:52 | reactormonk | drewsrem, so you basically want symbols? |
14:32:21 | drewsrem | reactormonk, hmmm... maybe |
14:32:32 | reactormonk | drewsrem, how about you just use a normal table as symbol table? Should be quick enough. |
14:32:42 | reactormonk | with a get-or-add-and-get |
14:34:35 | drewsrem | reactormonk, I figured that hashing and dealing with strings at runtime is overkill, the functionality is compileTime only anyway |
14:35:17 | reactormonk | drewsrem, the hashing will be done at compiletime... I think |
14:35:34 | drewsrem | reactormonk, oh really? - that'd be snazzy |
14:36:04 | reactormonk | drewsrem, otherwise static[T] - which is messy ^^ |
14:36:15 | drewsrem | reactormonk, :| |
14:36:24 | reactormonk | messy as in buggy |
14:36:59 | reactormonk | drewsrem, nope, doesn't do it. |
14:37:05 | drewsrem | figured :( |
14:37:28 | reactormonk | would be a cool feature though >:) - maybe with sideeffect free functions |
14:38:50 | drewsrem | Different question on the side: typedescs are compile time only right? |
14:39:06 | reactormonk | yup |
14:39:12 | reactormonk | IIRC |
14:46:46 | * | jszymanski joined #nim |
15:12:29 | * | xcombelle joined #nim |
15:14:18 | * | wirbi quit (Ping timeout: 246 seconds) |
15:23:26 | * | xcombelle quit (Ping timeout: 248 seconds) |
15:30:14 | * | Matthias247 quit (Read error: Connection reset by peer) |
15:32:10 | * | b_ quit (Ping timeout: 240 seconds) |
15:39:02 | * | arnetheduck quit (Ping timeout: 256 seconds) |
15:41:14 | * | Ven joined #nim |
15:54:59 | * | arnetheduck joined #nim |
16:01:00 | * | pafmaf joined #nim |
16:02:31 | * | NimBot joined #nim |
16:18:17 | * | b_ joined #nim |
16:19:34 | * | Ven quit (Quit: My MacBook has gone to sleep. ZZZzzz…) |
16:38:13 | * | luke joined #nim |
16:38:38 | * | luke is now known as Guest3223 |
16:41:50 | federico3 | is there the opposite of the export pragma? I want to stop exporting gEnv, cmdCount, cmdLine... |
16:43:08 | * | drewsrem quit (Quit: Leaving) |
16:56:51 | r-ku | federico3 do not add * to those symbols |
17:11:42 | * | xcombelle joined #nim |
17:11:58 | federico3 | r-ku: I want to do that externally, without tweaking nim's libraries |
17:14:05 | ekarlso | federico3: :P what u working on ? :D |
17:17:12 | * | xcombelle quit (Ping timeout: 264 seconds) |
17:17:57 | * | Guest3223 quit (Ping timeout: 265 seconds) |
17:18:00 | federico3 | ekarlso: an attempt to make a kernel module in Nim :) |
17:24:25 | ekarlso | federico3: ah |
17:26:48 | * | cyraxjoe quit (Ping timeout: 255 seconds) |
17:37:50 | * | cyraxjoe joined #nim |
17:38:27 | * | darkf quit (Quit: Leaving) |
17:49:49 | * | Demos joined #nim |
17:55:59 | r-ku | Araq thats how you wanted it? https://github.com/r-ku/Nim/commit/5fa1c38258742b3f059bb48c133d2df6459302f2 and https://github.com/r-ku/Nim/commit/045a8bcb629b549eec945c49931afa612cf6bc0e |
18:00:50 | * | Trustable quit (Remote host closed the connection) |
18:04:13 | * | b_ quit (Ping timeout: 246 seconds) |
18:11:09 | * | Demos quit (Remote host closed the connection) |
18:13:15 | * | Demos joined #nim |
18:13:40 | * | beatmox quit (Ping timeout: 252 seconds) |
18:14:23 | * | b_ joined #nim |
18:18:01 | * | Demos quit (Remote host closed the connection) |
18:22:06 | * | wirbi joined #nim |
18:22:15 | wirbi | Hello! |
18:23:15 | wirbi | About operator 'in' and sequences. |
18:23:47 | wirbi | For exaple I have code like: if i in graph: |
18:24:47 | wirbi | I case I need to do inverse operation in python I'll write: if i not in graph: |
18:25:14 | wirbi | But in Nim: if not(i in graph): |
18:27:04 | wirbi | Or may is more good solution in Nim? Because 'if i not in graph' would generate compile error. |
18:27:55 | wirbi | May be it's good to include 'not in' in the language? |
18:30:11 | renesac | wirbi: it is, see "notin" |
18:30:47 | wirbi | Oh, sorry. I'm so noob... |
18:30:50 | * | unclechu quit (Quit: Leaving.) |
18:35:37 | wirbi | Are in the plans to add one line generators like python [x for x in y if x%2==0] ? |
18:36:37 | wirbi | I soo miss it. |
18:40:11 | wirbi | And another question. In lib/js/dom.nim are some js structures. For example: |
18:40:18 | wirbi | Window* = ref WindowObj |
18:40:23 | wirbi | WindowObj {.importc.} = object of TEventHandlers |
18:40:57 | wirbi | var window* {.importc, nodecl.}: Window |
18:42:15 | renesac | wirbi: |
18:42:17 | renesac | https://github.com/nim-lang/Nim/issues/3116 |
18:43:46 | renesac | the first syntax is on the future module |
18:44:09 | wirbi | Can I extend WindowObj without editing lib/js/dom ? For example, add atob and btoa procs. |
18:44:24 | wirbi | renesac, Great! |
18:44:49 | renesac | the second one seems to work for assigining variables |
18:45:00 | renesac | but not for things like echo... |
18:45:49 | renesac | and rbehrends didn't report the bug yet, it seems |
18:48:35 | wirbi | renesac, For use it need I switch to devel branch or it's already in 0.11.2 ? |
18:49:00 | renesac | I think both can be used in the 0.11.2 |
18:49:11 | renesac | they are just macros/templates anyway |
18:50:49 | renesac | the problem are bugs in the compiler like the one preventing the rbehrends version from working well |
18:51:11 | * | aziz joined #nim |
18:51:54 | renesac | but as it is bugged on devel too, there is no reason to switch to devel at this time |
19:00:30 | * | b_ quit (Quit: Leaving) |
19:01:34 | * | unclechu joined #nim |
19:04:54 | * | mrx1 quit (Ping timeout: 255 seconds) |
19:10:15 | * | Matthias247 joined #nim |
19:11:29 | * | beatmox joined #nim |
19:19:41 | wirbi | How can I get macros generated code? For macro debug. |
19:21:38 | * | unclechu quit (Remote host closed the connection) |
19:29:14 | def- | wirbi: at the end of the macro you can "echo result.repr" |
19:29:24 | def- | or just echo result maybe |
19:37:54 | wirbi | def-, for echo result and echo $result it's generate compile error, for echo result.repr nothing echo on screen. |
19:39:15 | wirbi | def-, I add some echo in macro like echo "hello", but no out. |
19:39:49 | def- | does your macro generate a result? |
19:41:30 | wirbi | I don't know, but I get it from nim lib, and in it code is result assignment. |
19:42:27 | wirbi | lib/pure/future.nim macro `->` have 'result =' |
19:43:03 | wirbi | But no echo work. |
19:43:12 | def- | then after the "result =" "echo result.repr" should work |
19:51:33 | * | unclechu joined #nim |
19:51:53 | wirbi | def-, you right, it's work! Thank you! I wait echo on execution time, but echo was on compile time. |
19:52:37 | * | X67r joined #nim |
20:23:08 | * | insomniac joined #nim |
20:23:11 | insomniac | hello o/ |
20:24:08 | renesac | how do I make procs taking types as parameters? |
20:24:10 | renesac | https://gist.github.com/ReneSac/492bd9e4a4d8ef7e0f39 |
20:24:52 | renesac | or templates in this case |
20:25:13 | renesac | oh, as a proc it works |
20:25:41 | renesac | should the template work too? |
20:30:06 | insomniac | I'll add another question: is that possible to make PIC code with NIM? |
20:49:04 | * | jszymanski quit (Quit: computer sleeps...) |
20:54:19 | * | unclechu quit (Remote host closed the connection) |
21:00:15 | reactormonk | insomniac, what's PIC code? |
21:00:41 | reactormonk | renesac, that's usually called a "generic" |
21:01:47 | renesac | so? |
21:02:08 | renesac | well, I discovered that what I want to do is kinda limited, as I can't convert between types on compile time |
21:04:01 | insomniac | reactormonk: position-independent code |
21:04:11 | insomniac | what you get with -fPIC -shared with GCC |
21:04:14 | reactormonk | insomniac, doesn't tell me anything |
21:04:21 | insomniac | reactormonk: I'm sorry for that |
21:04:35 | reactormonk | insomniac, you can pass these compiler flags, is that enough? |
21:04:43 | reactormonk | --passC:-fPIC |
21:05:06 | insomniac | reactormonk: not that easy - I didn't know NIM until today, and a friend of mine insisted to write an LKM in NIM |
21:05:17 | insomniac | I hacked some stuff and actually ran NIM code at kernel space |
21:05:26 | insomniac | but to make it really work I need to generate PIC code |
21:05:42 | reactormonk | so where is PIC relevant for your code? How does PIC code look like in C? |
21:05:50 | insomniac | reactormonk: in PIC code there are no relocs |
21:06:08 | insomniac | it's like old-world userspace code where you don't relocate sections at runtime |
21:07:22 | reactormonk | Could you give me some C code? I sadly don't know too much at all about kernel dev, but maybe I can help you if I see some code, and how you can use nim to express similar things |
21:08:14 | reactormonk | ... or you could wait for someone who does that kinda stuff, we have some IIRC :-) |
21:08:25 | reactormonk | Or post it at http://forum.nim-lang.org/ |
21:08:28 | insomniac | reactormonk: I'll publish the code on github as soon as it's ready -- the code is not really relevant, it's matter of how it's compiled |
21:08:39 | insomniac | it makes more sense to post the Makefile |
21:08:49 | reactormonk | so what else do you require besides passing the correct compiler flags? |
21:09:16 | insomniac | understanding how to tell Nim not to require any standard library |
21:09:28 | insomniac | no libc nor anything else |
21:10:02 | insomniac | so far I passed -static -nostdlib -fno-common and --noMain --noLinking --os:standalone |
21:10:12 | insomniac | respectively to the underlying call to gcc and to Nim itself |
21:10:18 | reactormonk | sounds good to me, got anything useful? |
21:10:22 | insomniac | basically, I need to create an entirely self-contained object |
21:10:25 | insomniac | yeah |
21:10:34 | insomniac | I could dereference a null pointer at kspace :) |
21:10:39 | reactormonk | >:) |
21:11:46 | reactormonk | sooo... what's your blocker? |
21:12:41 | insomniac | I need to understand what systemInit and systemDatInit are (considering that I never used Nim before today) |
21:13:23 | insomniac | and how to avoid Nim code to require it |
21:13:45 | insomniac | according to objdump, these are mentioned in the relocs |
21:14:10 | insomniac | (might also be not possible, depending on the language design) |
21:14:19 | reactormonk | they are inits for the system module... lemme see what's in there. Generated C code is in nimcache/ |
21:14:53 | insomniac | yeah |
21:15:09 | insomniac | declared with NIM_EXTERNC |
21:15:43 | * | flaviu quit (Ping timeout: 264 seconds) |
21:15:49 | insomniac | and used by PreMain |
21:17:02 | insomniac | I could get rid of them manually, since they are not really required |
21:17:10 | insomniac | but I'd like to get rid of them at compile time |
21:17:48 | reactormonk | You think you could post your question on the forum? Most people here are EU, and they're about to go to bed I'd say |
21:18:06 | * | flaviu joined #nim |
21:18:09 | insomniac | I am in EU as well :P BTW I will |
21:18:56 | insomniac | but tomorrow |
21:19:27 | insomniac | oh wait |
21:19:33 | insomniac | is there a way not to generate NimMain ? |
21:19:44 | insomniac | that seems to be the root cause |
21:19:52 | insomniac | --noMain doesn't really help |
21:20:52 | renesac | http://hookrace.net/blog/nim-binary-size/ <-- maybe this can help? |
21:21:17 | insomniac | checking |
21:22:09 | * | wirbi quit (Ping timeout: 246 seconds) |
21:22:13 | insomniac | renesac: maybe, yes :) thanks for the link |
21:22:21 | renesac | he uses "-passL:-nostdlib" and then "proc main {.exportc: "_start".}" |
21:22:26 | * | flaviu quit (Ping timeout: 256 seconds) |
21:22:31 | insomniac | reminds me of the teensy ELF article :) |
21:22:33 | renesac | I'm not sure how functional nim will be with this |
21:22:38 | insomniac | here if anyone cares, http://www.muppetlabs.com/~breadbox/software/tiny/teensy.html |
21:22:57 | insomniac | renesac: not much, no memory management and so on, just the kernel as framework |
21:23:00 | renesac | yes, he liked it at the end |
21:23:15 | insomniac | renesac: also, it's just for fun after talking to a friend |
21:23:29 | renesac | *linked |
21:23:40 | insomniac | cool |
21:24:36 | * | flaviu joined #nim |
21:28:44 | * | aziz quit (Remote host closed the connection) |
21:29:24 | * | Varriount joined #nim |
21:30:52 | insomniac | mh.. I can get rid of the symbol export but not the internal call to it |
21:31:48 | insomniac | got it |
21:31:52 | insomniac | that's because of the gc |
21:31:56 | insomniac | removed, that works |
21:32:00 | insomniac | --gc:none |
21:32:22 | renesac | "The final trick of this section is to tell GCC to optimize away unused functions. " <-- see that par |
21:32:34 | renesac | or maybe you don't need it |
21:32:56 | insomniac | yeah, but that's code that runs at userspace |
21:33:01 | insomniac | so these options are not enough |
21:33:13 | insomniac | --gc:none removed the dependency on systemInit |
21:34:05 | insomniac | still, I get a null ptr dereference, I'll fire up gdb |
21:35:07 | insomniac | hah, got it, the .o has a nice lea 0x0(%ip), %rdi :) |
21:35:39 | insomniac | so, now it tracks back to the nim source |
21:35:45 | insomniac | where I declared an extern printk |
21:35:48 | insomniac | and called it |
21:35:49 | Varriount | reactormonk: If my suspicions are right, Araq is currently on a plane |
21:42:47 | insomniac | renesac: I managed to call printk, even if still failing because of the ptr to the string to print |
21:42:52 | insomniac | nice one, thanks |
21:43:33 | renesac | you are welcome |
21:50:24 | * | drewsrem joined #nim |
21:50:50 | * | Kingsquee quit (Remote host closed the connection) |
21:51:15 | * | Kingsquee joined #nim |
21:53:50 | insomniac | renesac: is there any way to use C strings instead of NIM_CHAR ? |
21:54:12 | insomniac | renesac: I found that it's trying to do printk(*str) where str is 12, which is the length of the string |
21:54:27 | insomniac | where the NIM_CHAR is a struct containing two items, the string length and the string itself |
21:54:39 | insomniac | I need to jump to the second element of the string |
21:54:41 | renesac | you should take the pointer to the first element of the string |
21:54:51 | insomniac | is there a way using Nim's syntax? |
21:54:53 | renesac | addr(str[0]) |
21:55:03 | renesac | before the first element there is the lenght and capacity |
21:55:26 | insomniac | ok, so imagine that I have a function, call it 'func' that takes a C string as parameter |
21:55:30 | insomniac | declred as extern |
21:55:42 | insomniac | and I want to do func("Hello world\n"); |
21:55:45 | renesac | cstring may do it automatically for you |
21:55:49 | insomniac | from Nim |
21:55:55 | insomniac | can you show me the docs? |
21:55:57 | renesac | I'm not sure |
21:56:14 | insomniac | nevermind, found it |
21:56:21 | insomniac | ttp://nim-lang.org/docs/manual.html#types-cstring-type |
21:56:49 | renesac | http://nim-lang.org/docs/backends.html#memory-management-strings-and-c-strings <-- also this |
22:01:45 | * | ozra joined #nim |
22:01:58 | * | pafmaf quit (Quit: Verlassend) |
22:11:10 | * | vendethiel quit (Ping timeout: 240 seconds) |
22:29:12 | * | bjz quit (Quit: My MacBook Pro has gone to sleep. ZZZzzz…) |
22:30:24 | * | Varriount quit (Ping timeout: 246 seconds) |
22:53:32 | * | drewsrem quit (Quit: Leaving) |
23:04:49 | * | boop is now known as boopisaway |
23:23:32 | * | Matthias247 quit (Read error: Connection reset by peer) |
23:28:50 | * | X67r quit (Quit: leaving) |
23:41:16 | * | Varriount joined #nim |