3 ms·
That's what I figured. So not "trivial".
by jjnoakes 10y ago
That's what I figured. So not "trivial".
- dom96 10y agoAre you aware of any language's whose FFI is that trivial?
- jjnoakes 10y agoDo I have to be aware of some other language with such a trivial FFI in order to question the claim that Nim has such a trivial FFI? (C++ has such a trivial FFI, as well as non-GC languages which compile to C code... there may be more as well)
- dom96 10y agoSorry, it wasn't my intention to imply that. I'm genuinely curious, I haven't used many language's FFI to know which is best. You mention non-GC languages. Are there any GC languages that do? :)
- jjnoakes 10y agoI don't think so. I think by virtue of having a GC language you pretty much have to manually anchor pointers before calling code which knows nothing of the GC. But if anyone knows of counter examples, I would be interested in them as well.
- klibertp 10y ago> you pretty much have to manually anchor pointers before calling code which knows nothing of the GC. Which I'd still consider trivial...
- jjnoakes 10y agoI wouldn't. Trivial to me means a call to a C routine looks and feels like a call to a native routine. Manually managing the memory that the GC "owns" doesn't fit the bill in my definition.
- nickpsecurity 10y agoThe example for Go looks pretty straight-forward: https://golang.org/cmd/cgo/ https://golang.org/cmd/cgo/ Not an expert on these things by far but I remembered painless use of C in that language and it's GC'd. Thoughts?
- kibwen 10y agoThere are various restrictions on passing pointers between Go and C, see the "Passing pointers" section of your link.
- nickpsecurity 10y agoYeah, that does start getting complicated enough to change the code on either side.
- pathsjs 10y agoYou are right, this situation is not trivial. But it is also quite rare in practice