Fortran Coder

标题: 求助一个有关Fortran动态链接库的问题 [打印本页]

作者: 小剑    时间: 2021-4-14 19:38
标题: 求助一个有关Fortran动态链接库的问题
有一款仿真软件是使用如下方法进行二次开发的:
file:///C:\Users\XIAOJIANJJJ\Documents\Tencent Files\1429709479\Image\C2C\HTLG$2G3BL_EZRW)25~R4IJ.png1. Implement an equation for wear rate within the FORTRAN subroutine and save it as UserWearModel.fNote: A sample UserWearModel.f exists within the advanteng bin.
2. Compile the subroutine to a *.dll file by typing the following command into the Intel FORTRAN COMPILER:
>ifort /DLL /libs:static /threads UserWearModel.f
3. If necessary, rename the *.dll file as UserWearModel.dll
4. Replace any existing UserWearModel.dll file located in the advanteng bin with the new
UserWearModel.dll
5. Create a simulation

我按照这个用VS+IVF进行编译之后,替换掉原来的.dll文件之后,发现仿真软件无法正确使用了。还有就是软件自带的.dll文件只有8kb,而我编译的确有17.5kb,文件代码如下
c     User Defined Tool Wear Subroutine
c     Version 4.4-006
c     Copyright Third Wave Systems, Inc 2003
c     7900 West 78th Street - Suite 250
c     Edina, MN 55439
c     1.952.832.5515
c
      SUBROUTINE WEARMODEL_USER(wdot,pressure,velocity,temperature,
     1            uwearpar)
c
!DEC$ ATTRIBUTES DLLEXPORT :: WEARMODEL_USER
      implicit real*8 (a-h,o-z)
      real*8 uwearpar(10)
c
c uwearpar(10) is cutting velocity unless user assigns number.
c
c Usui's Model
c
      wdot=pressure*velocity*uwearpar(1)
     1     *exp(-uwearpar(2)/(temperature+273.15))
c
      return
      end

科研任务十分紧迫,我还是个新手,对动态链接库不是特别懂,希望有大佬指点!!!

作者: vvt    时间: 2021-4-14 19:38
可能有这么几个原因。
1. 你的 DLL 是32位,但仿真软件需要64位(或反过来)
2. 你的 DLL 依赖一些运行时库的DLL,需要同时复制。详解 http://dlllose.w.fcode.cn
3. 你的 DLL 没有导出必要的函数。可以用上面的链接里的软件 Dependency walker 查看导出函数,是否符合要求。
作者: li913    时间: 2021-4-16 09:31
无法使用,错误提示是啥?检查代码的接口是否正确,dll是32还是64位的?
作者: 小剑    时间: 2021-4-16 16:49
替代了之后,没有错误提示,仿真软件直接点simulation,无任何反应,简单来说就是仿真软件无法正常工作了
作者: 小剑    时间: 2021-4-17 13:31
我下载的 Dependency walker怎么打不开DLL文件
作者: 小剑    时间: 2021-4-18 19:32
依赖项有这个msvcr90.dll文件是什么意思
作者: vvt    时间: 2021-4-18 20:23
msvcr90 = MicroSoft Visual C++ Runtime Library 9.0




欢迎光临 Fortran Coder (http://bbs.fcode.cn/) Powered by Discuz! X3.2