| 
 | 
 
5F 币 
有一款仿真软件是使用如下方法进行二次开发的: 
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 
 
科研任务十分紧迫,我还是个新手,对动态链接库不是特别懂,希望有大佬指点!!! 
 |   
 
 
最佳答案
查看完整内容 
可能有这么几个原因。
1. 你的 DLL 是32位,但仿真软件需要64位(或反过来)
2. 你的 DLL 依赖一些运行时库的DLL,需要同时复制。详解 http://dlllose.w.fcode.cn
3. 你的 DLL 没有导出必要的函数。可以用上面的链接里的软件 Dependency walker 查看导出函数,是否符合要求。 
 
 
 
 
 
 
 |