许可优化
许可优化
产品
产品
解决方案
解决方案
服务支持
服务支持
关于
关于
软件库
当前位置:服务支持 >  软件文章 >  adams C语言用户子程序:Adams 2013编译生成DLL超详细教程

adams C语言用户子程序:Adams 2013编译生成DLL超详细教程

阅读数 4
点赞 0
article_banner

《Adams2013编译C语言用户子程序生成dll超详细教程讲解》由会员分享,可在线阅读,更多相关《Adams2013编译C语言用户子程序生成dll超详细教程讲解(9页珍藏版)》请在人人文库网上搜索。

1、1.操作系统: Windows xp 32 位2.软件版本: Adams 2013 32 位、 Visual Studio 2010 专业版 32 位3.编译软件: Intel Visual Fortran 11.04.环境配置:(1) 在操作系统环境变量 Path 中增加 Adams 启动文件 mdi.bat 的路径,如 https://www.gofarlic.comMSC.SoftwareAdams2013commonmdi.bat(2) 把 Fortran 安装路径,如https://www.gofarlic.comIVF2011IntelComposerXE-2011compilerlibia32(3) 把 libifcoremd.lib 、libifcoremd.li。

2、b 、libmmd.lib 、libifportmd.lib 、libirc.lib 、svml_dispmd.lib 这 6 个库文件复制到 Adams 安装路径下 win32 文件夹下5.编写用户子程序Adams 安装程序 https://www.gofarlic.comMSC.SoftwareAdams2013solverc_usersubs 文件夹下有 C 语言编写 的常用的用户子程序,其中 slv_c_utils.h 文件是用户子程序的头文件。编写用户子程序时, 在这些程序的基础上进行更改会有事半功倍的效果。本文以编写 VForce 用户子程序为例,对其编写、编译操作过程进行说明。复制 vfosub.c 和 slv_c_uti。

3、ls.h 两个文件到个人工作文件夹 Adams_Matlab ,本文直接使用 vfosub.c 的原始代码,其代码为:#include slv_c_utils.hadams_c_Vfosub Vfosub;/* Note:* Use mixed case names for the Adams subroutine names when using the C* style interface. For the default subroutine name capitalize the first* letter and have the remaining letters lower ca。

4、se; Gfosub for example.* Doing this insures that Adams Solver correctly distinguishes a C style* subroutine from Fortran and calls with the appropriate interface.*/void Vfosub( const struct sAdamsVforce* vfo, double time, int dflag, int iflag, double * result)/* Assign readable variable names to pas。

5、sed parameters */double c=vfo-PAR0;int ipar3=( int )vfo-PAR1, ( int )vfo-PAR2,( int )vfo-PAR1;/* Local variables */double vel3;int nstates;int errflg;/* call SYSARY for translation velocities TVEL */c_sysary( TVEL, ipar, 3, vel, &nstates, &errflg);c_errmes(errflg,Error calling SYSARY for TVEL, vfo-I。

6、D, STOP);/* - Evaluate VFORCE components */result0 = -c * vel0;result2 = -c * vel1;result2 = -c * vel2;注意:因为代码中引用了slv_c_utils.h,复制时必须同时复制slv_c_utils.h文件,否则编译时会报错。6编译操作(1)在开始菜单下,启动Visual Studio 2010命令提示工具。https://www.gofarlic.comAdams_Matlab ,(3)输入指令 https://www.gofarlic.comMSC.SoftwareAdams2013commonmdi.bat 并按回车,(2)把工作路径设置到用户子程序文件所在路径 输入指令 cd。

7、 https://www.gofarlic.comAdams_Matlab并按回车。於 Visual Studio 命令提示(2010)getting enuironment for us ing Microsoft Uiwual Studio 2010 x86 too IsI): Microsof t Uisual Studio 10.0MJCcd https://www.gofarlic.com dams_Mat lab https://www.gofarlic.com Adams_Mat labhttps://www.gofarlic.com MSC. Sof tware Adams X2U13 eominonXridi. bat系统进入 Adams环境中输入cr-u并按回车,(6)进入编译子程序,这时系统提示是否在调试状态下连接,直接输入回车。(7)输入C语。

8、言用户子程序的文件名vfosub.c并回车(注意:该文件必须是以.c为后缀名,不能以.cpp为后缀名,并且该文件必须在当前路径下存在)1 Von mav enter ain object file compiled with: ifor-t Zc /auto /0b2 /MD /Gm xxx.Forcl Zc /Ox /MD /EHsc xxx.c2 Vouenter tlie nane of t-lie _f, _c or _cxx source f ile3 Vou may use a list file Enter name of fii*st user ohject or source。

9、 file or EXIT: fo&ub.cEnterof next user object or source FHe CFOnone?, or EXIT(8)系统提示输入下一个文件名称,这时直接点击回车;1Vou mai enter an object f ile conpiled uitli:(Intel Fortran XE 2011ifort Zc Zawta /0b2 /MD ZGn xxx.f01*Microsoft Uisual Studio 2010cl Ze /Ox /MD /EHsc xxx_c2 You may enter the name of the F” c or。

10、 cxx source file3 You use a list File Enter name of first user object or source ile or EMIT:fosub _cEnter nane of next user object or ouice file =nane, or EXIT:Enter nane oF yom?1 ADA MS/So lver User-DLL or EXIT:(9)然后输入生成的dll文件的名称,这个文件名可不与c文件同名,比如输入myvfosub.dll,1 Vou may enter an object file compile。

11、d with:iFort /c /auto /0b2 /ML /Gm xxx.ForCMicrosoft Uisual Studiocl /c /Ox /HD /EHsc xxx.c2 You nay enter the mane of the F or cxx source file3 Vou ntay use a list f ile =nane, or EXIT:Enter name of aur ADAMS/Soluer User-DLL or EXIT:myuf osul_ dll(10)然后点击回车,系统进行编译。编译完成后,如果系统提示编译成功,会在vfosu.c所在的文件夹中生成编译成功的dll文件,至此完成用户子程序的编译。(11)生成dll文件如下图所示:


免责声明:本文系网络转载或改编,未找到原创作者,版权归原作者所有。如涉及版权,请联系删

相关文章
QR Code
微信扫一扫,欢迎咨询~
customer

online

联系我们
武汉格发信息技术有限公司
湖北省武汉市经开区科技园西路6号103孵化器
电话:155-2731-8020 座机:027-59821821
邮件:tanzw@gofarlic.com
Copyright © 2023 Gofarsoft Co.,Ltd. 保留所有权利
遇到许可问题?该如何解决!?
评估许可证实际采购量? 
不清楚软件许可证使用数据? 
收到软件厂商律师函!?  
想要少购买点许可证,节省费用? 
收到软件厂商侵权通告!?  
有正版license,但许可证不够用,需要新购? 
联系方式 board-phone 155-2731-8020
close1
预留信息,一起解决您的问题
* 姓名:
* 手机:

* 公司名称:

姓名不为空

姓名不为空

姓名不为空
手机不正确

手机不正确

手机不正确
公司不为空

公司不为空

公司不为空