隔离和繁殖过程中的实例化一个C库 [英] Isolating and multiply instantiating a C library in-process

查看:131
本文介绍了隔离和繁殖过程中的实例化一个C库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们有一个C库(.LIB Windows和放大器; .A Linux版)。只允许一个单身的创作并且还不能正常关机(内存泄露和线程活着离开)已经被实例化一次。

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.

重写,并追捕的错误不谈,有一个简单的方法来隔离这种过程中的行为不端code,使得单身限制可以被删除,不洁tidyup可沙盒?

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?

我主要感兴趣的任何过程中的选项,如果确实有的话。一个单独的进程显然会解决这个问题,但会产生一种架构的开销,使图书馆的遥控除非有非常低的影响,解决方案(它具有广泛的API,所以保持了大量的胶水是不是特别有吸引力)。

I am mainly interested in any in-process options, if indeed there are any. A seperate process would obviously solve 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).

推荐答案

很抱歉,但没有任何的简单的方式做到这一点。沙盒行为不当库使用独立的进程,你已经建议自己常见的做。像Protocol Buffers的一个IPC工具可能有助于确定并实施IPC协议。

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.

这篇关于隔离和繁殖过程中的实例化一个C库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆