我有一些像这样构造的代码:
固定主线 - >用户代码 - >依赖库
这三个部分可以静态链接,一切都很好。 或者,主线可以变成可执行文件 并将用户代码转换为dylib,主线加载 使用dlopen()的用户代码,并使用dlsym()输入它。
我有数百个测试程序可以正常工作,但有两个案例 它失败的地方:
在gmp情况下,动态程序打印正确的答案,然后终止:
flx_run(29601) malloc: *** error for object 0x7fff712ac500: pointer being freed was not allocated *** set a breakpoint in malloc_error_break to debug Abort trap (gdb) bt #0 0x00007fff8438e0b6 in __kill () #1 0x00007fff8442e9f6 in abort () #2 0x00007fff84346195 in free () #3 0x00000001000d3a35 in flxusr::gmp__hyphen_0::_init_ () Previous frame inner to this frame (gdb could not unwind past this frame)
我猜这里会有一些内存损坏。
在SDL案例中:
~/felix>LD_LIBRARY_PATH=build/release/lib/rtl build/release/bin/flx_arun demos/sdl/sdl-1.01.03-0.dylib frames in seconds = FPS frames in seconds = FPS frames in seconds = FPS
而
~/felix>demos/sdl/sdl-1.01.03-0 98 frames in 5.016 seconds = 19.5375 FPS 100 frames in 5.043 seconds = 19.8295 FPS 82 frames in 5.043 seconds = 16.2602 FPS
帧速率数据由
格式化_urv20946 = ::flx::rtl::strutil::str(((double)PTF Frames / seconds ));
,其中
template<class T> string str(T const &t) { std::ostringstream x; x << t; return x.str(); }
注意这段代码是“在”一个依赖库中(当然不是,它在头文件中!)
有什么想法吗?