开发者

Isolating and multiply instantiating a C library in-process

We have a C library (.lib windows & .a linux) that only allows creation of a singleton and that also doesn't shut down properly (memory leaked and threads left alive) having been once instantiated.

Rewriting it and hunting down the bugs aside, is there a simple way to isolate this kind of misbehaving code in-process such that the singleton restriction can be removed, and the unclean tidyup can be sandboxed?

I am mainly interested in any in-process options, if indeed there are any. A seperate process would obviously so开发者_C百科lve it, but would incur an architectural overhead to allow remote control of the library unless there are very low impact solutions for that (it has a wide API, so maintaining a lot of glue is not particularly attractive).


Sorry, but there is no simple way to do this. Sandboxing badly behaving libraries is commonly done using separate processes, which you already suggested yourself. An IPC tool like Protocol Buffers might help in defining and implementing the IPC protocol.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜