You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

调用GCC编译的CUDD库时MSVC触发断言,求问题排查

CUDD库跨编译器调用的I/O断言错误问题

背景与编译环境

本人C/C++技能较为生疏,上一次使用已是30年前。在Win10系统下通过MSYS2的MINGW64环境从源码编译CUDD库,编译命令如下:

git clone https://github.com/ivmai/cudd.git
cd cudd
autoreconf -f -i
mkdir build
cd build
../configure "CFLAGS=-fPIC -std=c99" --enable-silent-rules --enable-shared --enable-dddmp --enable-obj --prefix=/home/Anton/cudd.no_target/cudd/build
make -j4
make check
make install

调用场景与出错代码

按照相关教程与指南,使用Visual Studio 2022调用该CUDD库(因静态链接报错,故采用DLL链接)。但如下代码在执行fclose时触发断言:

/**
* Writes a dot file representing the argument DDs
* @param the node object
*/
void write_dd (DdNode *dd, char* filename)
{
FILE *outfile; // output file pointer for .dot file
outfile = fopen(filename,"w");
DdNode **ddnodearray = (DdNode**)malloc(sizeof(DdNode*)); // initialize the function array
ddnodearray[0] = dd;
Cudd_DumpDot(gbm, 1, ddnodearray, NULL, NULL, outfile); // dump the function to .dot file
free(ddnodearray);
fclose (outfile); // close the file */}
}

问题现象

断言信息对应close.cpp第56行。相同代码在GCC编译运行时无任何问题。尝试编译运行CUDD测试用例,MSVC会大量抛出I/O断言错误,而GCC下运行正常。

需求

想知道问题出在哪里?目标是为CUDD编写.NET包装器,因为现有PATBDD包装器缺少ADD与DDDMP功能,且目前没有具备BDT->ROBDD、手动/动态变量重排序等基础功能的.NET原生二叉决策树/图库。

内容的提问来源于stack exchange,提问作者Anton Krouglov

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.11 20:03:21