multiple ruby extension modules under one directory

こ雲淡風輕ζ 提交于 2019-12-13 01:43:22

问题


Can sources for discrete ruby extension modules live in the same directory, controlled by the same extconf.rb script?

Background: I've a project with two extension modules, foo.so and bar.so which currently live in their own subdirectories like so:

myproject/ext/foo/extconf.rb
myproject/ext/foo/foo.c
myproject/ext/foo/foo.h

myproject/ext/bar/extconf.rb
myproject/ext/bar/bar.c
myproject/ext/bar/bar.h

I'd prefer that all .c and .h sources simply reside under ext/ under the control of a single extconf.rb file, but I don't know how to get mkmf play along.


回答1:


With mkmf, you will need to use separate directories; it's not designed for putting multiple extensions in the same directory.

You may be able to use one of the mkmf alternatives (e.g. mkrf) to put the extensions in the same directory; I don't know whether or not this will work. I once wanted to do the same thing, but eventually discovered that as my library grew, having multiple directories for my extensions became desirable for keeping the project organized.



来源:https://stackoverflow.com/questions/1701611/multiple-ruby-extension-modules-under-one-directory

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!