dvbbs
收藏本页
联系我们
论坛帮助
dvbbs

>> Fortran语言开发经验交流
搜一搜相关精彩主题 
Fortran中文网Fortran中文网—Fortran语言经验交流Fortran语言开发经验交流 → 有c#和fortran混合编程的问题请教老师们 复数传参问题

您是本帖的第 2514 个阅读者
树形 打印
标题:
有c#和fortran混合编程的问题请教老师们 复数传参问题
lingdu0001
帅哥哟,离线,有人找我吗?
等级:新手上路
文章:1
积分:212
门派:无门无派
注册:2012年5月12日
楼主
 用支付宝给lingdu0001付款或购买其商品,支付宝交易免手续费、安全、快捷! 点击这里发送电子邮件给lingdu0001

发贴心情
有c#和fortran混合编程的问题请教老师们 复数传参问题
现在在给我老板的fortran程序进行封装,将其编译成dll以后再c#里面调用。现在遇到一个问题,需要请教大神们。。    我的c#如何往dll里面传递复数的参数,和取出计算以后复数的结果呢?    c#我引用了System.Numerics;,里面有complex的类型了    谢谢大神们!!我尝试的结果 是编译运行无错误,但是计算输出的结果没有变化,下面是我的fortran代码subroutine kerrde(dk,ek,rratio)    !dec$ attributes c,dllexport,alias:'Kerrde'::kerrde    complex*16 rratio    ddk=2*dreal(rratio)/(1-rratio*dconjg(rratio))    dk=0.5*atan(ddk)    eek=2*dimag(rratio)/(1+rratio*dconjg(rratio))    ek=0.5*asin(eek)    returnend subroutine kerrde下面是我的c#代码        [DllImport("CoreDll.dll", CallingConvention = CallingConvention.Cdecl)]          public static extern void Kerrde(Complex rratio, out double dk, out double ek);            double x1,x2;            Complex x=new Complex(1, 1.554);            CoreMain.Kerrde(x, out x1, out x2);输出的 x1 x2都是0.ezstyle{font-size: 10px;white-space:nowrap;}table#EzStylish-Table { background: #DEE7F7 !important; border: 1px solid #313163 !important; border-collapse: collapse !important; }div.EzStylishSep-Div { font: normal normal 11px/136% Tahoma !important; background: #ACD2F5 !important; border: 1px outset #ACD2F5 !important; color: #3373A6 !important; display: block !important; margin: 1px 0 1px 0 !important; text-align: center !important; }div.EzStylishCnt-Div { display: block !important; }button.EzStylishBut, input.EzStylishBut { font: normal normal 11px/136% Tahoma !important; background: #65A5D8 !important; border-color: #65A5D8 !important; border-width: 1px !important; color: #FFFFFF !important; display: inline !important; float: none !important; font-size-adjust: none !important; letter-spacing: 1px !important; text-decoration: none !important; text-indent: 0 !important; visibility: inherit !important; }button.EzStylishBut { margin: 6px 0 0 0 !important; padding: 0 3px 0 3px !important; text-align: center !important; max-width: 120px !important; height: auto!important; width: auto!important; }a.EzStylishLink, span.EzStylishLink, label.EzStylishLink { font: normal normal 11px/136% Tahoma !important; position: relative !important; left: 0!important; top: 0!important; width: auto !important; height: auto !important; z-index: auto !important; min-width: 0 !important; max-width: none !important; background: transparent !important; border-style: none !important; border-spacing: 2px!important; outline-style: none !important; direction: ltr !important; float: none !important; font-size-adjust: none !important; letter-spacing: 1px !important; margin: 0 !important; padding: 0 !important; text-align: left !important; text-decoration: none !important; text-indent: 0 !important; text-transform: none !important; visibility: inherit !important; white-space: nowrap !important; cursor: hand!important; }div.EzStylishtext { font: normal normal 11px/136% Tahoma !important; }
[此贴子已经被作者于2012-5-12 13:53:04编辑过]
ip地址已设置保密
2012-5-12 13:52:20

 1   1   1/1页      1    
网上贸易 创造奇迹! 阿里巴巴 Alibaba
Powered By Dvbbs Version 7.1.0 Sp1
Copyright ©2005 - 2008 www.fortran.cn
页面执行时间 0.18750 秒, 5 次数据查询
京ICP备05056801号