3 ms·
I do think that Julia in general isn't the best for interacting with C(based off of some experimenting 2 years ago). I have tried using it with a decent number
by melissalobos 4y ago
I do think that Julia in general isn't the best for interacting with C(based off of some experimenting 2 years ago). I have tried using it with a decent number of odd C libraries used in Scientific Computing(with actual capital S and C. Which always involved binary blob libraries.). I think if you control more of the stack it is a better language. But when using it with vendor provided binaries I ran into many many issues.
> "with actual capital S and C." This part was referencing the industry and not me being egotistic.
- celrod 4y agoI find `ccall` and especially `@ccall` easy to use, but thankfully haven't spent much time wrapping C libraries so I'd consider myself far from an expert in the matter. Creating mutable structs and `GC.@preserve`ing them is an effective means of getting stack allocated memory, so long as the structs do not escape. E.g., I occasionally follow this approach: mem = Ref{NTuple{32,Float64}}() GC.@preserve mem begin p = Base.unsafe_convert(Ptr{Float64}, mem) # do things with p, e.g. pass it to a C library end
- deleted 4y ago[deleted]
- abhimanyuaryan 4y agobut the whole point of using Julia is that you don't need C(relatively same speed). Why would you interface it a Scientific Computing library written in C. Also C doesn't really sound like a good language for Scientific Computing. People do SC in Python and which is why Julia i.e. to solve two language problems and mind boggling speeds like C with syntax like Python
- uecker 4y agoC is an excellent language for scientific computing. A lot of low-level and high-level libraries for scientific computing are written in C. Toolchain support is excellent. It is maybe less good a putting some scripts together quickly.
- abhimanyuaryan 4y agowhat are some of these libraries that are written in C but don't have python bindings if I may ask. Genuine question the once I have seen have python binding and that's why they are super popular and widely used.