cfortran 发表于 2017-7-21 21:07:49

C++中如何把多组类的数据传递给Fortran的dll

class unitinfo
{
public:
      int cotrolno;
      CString unitname;
      int unittype;
      int solid;
      double coearea;
      double shapepara;
      double rotationpara;
      double tranpara;
      int pn;
      double *plist;
};
这里这组数据共有n组,所以我用的是动态分配
public:
unitinfo *inunit;
singlenum=5;!外部输入的
inunit=new unitinfo;
里面具体的赋值就不粘了
typedef void(*model)(int&,class unitinfo*);
model hydromodel=(model)GetProcAddress(kLibrary,"hydromodel");

hydronodel(singlenum,&(inunit));
我是这样处理的,结果调试发现好像只有第一组的数据传进去了,后续数据没有在Fortran的Dll中计算。请帮我看看我该怎么做

fcode 发表于 2017-7-21 22:44:43

和传递数组一样。只不过是派生类型的数组而已。

需要注意的是 ,CString 这种扩展类,是不能传递的。fortran不认识它。
页: [1]
查看完整版本: C++中如何把多组类的数据传递给Fortran的dll