开发者

Is there a way to link mex file against code compiled without -fPIC

I am trying to wrap some C code to access it with Matlab/Octave. The problem is 开发者_运维百科that the code has not been compiled with -fPIC, which seems to be necessary to wrap it with mex files. I don't have access to all of the source code so recompiling with -fPIC is no option. Is there any way around this problem?


Unfortunately I don't think there is. You may have to build a standalone executable and use the "system" command to run that.


The -fPIC switch generates position-independent code suitable for use in a shared library. If you have code generated without -fPIC, it isn't position-independent, and can't be used in a shared library. Since MEX-files are shared libraries, you won't be able to use non-PIC code in them.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜