Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Can I include a C source file in RubyMotion project, compile it, and call the C functions directly from Ruby? That can be done easily with Obj-C.

I was looking for its answer for some time now. Our projects include a lot of C code.



Yes, you can vendor pure C libraries and use their APIs in a RubyMotion project (assuming the C interface is simple enough). Here is an example that uses the OpenGL C APIs: https://github.com/HipByte/RubyMotionSamples/tree/master/Hel...


I'm honestly not sure, I have no experience with Objective-C but just from reading I think you'll still need to write an Objective-C interface/wrapper for your C code before it can be interfaced with RubyMotion.

Edit: A discussion topic on the newsgroup about it: https://groups.google.com/d/msg/rubymotion/tn5p3g071OE/5jyJI... (you'll have to sign up I think)




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: