c#调用c++dll参数问题

liuhaisong290 2012-12-18 04:53:05
//c++函数:
CMT_DLL_API XsensResultValue cmtDataGetOriEuler(const int32_t instance, CmtEuler* data, const CmtDeviceId dev=0, void* bundle=NULL);
//CmtEuler 是结构
struct CmtEuler {
double m_roll; //!< The roll (rotation around x-axis / back-front-line)
double m_pitch; //!< The pitch (rotation around y-axis / right-left-line)
double m_yaw; //!< The yaw (rotation around z-axis / down-up-line)
};
//! The type of a Device Id
typedef uint32_t CmtDeviceId;


求解在c#中要怎么调用这个函数,下附我自己写的函数
public static extern XsensResultValue cmtDataGetOriEuler(int instance, ref CmtEuler data, int dev);
[StructLayout(LayoutKind.Explicit)]
public struct CmtEuler
{
[FieldOffset(0)]
public double m_roll;//!< The roll (rotation around x-axis / back-front-line)
[FieldOffset(4)]
public double m_pitch;//!< The pitch (rotation around y-axis / right-left-line)
[FieldOffset(8)]
public double m_yaw;//!< The yaw (rotation around z-axis / down-up-line)
}
出现下面的错误,请大牛帮忙
...全文
80 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
liuhaisong290 2012-12-18
  • 打赏
  • 举报
回复
自己顶起来!
liuhaisong290 2012-12-18
  • 打赏
  • 举报
回复
有没有大牛来解答呢?
liuhaisong290 2012-12-18
  • 打赏
  • 举报
回复
一致 我已经写了几个函数了,这个函数出现了结构和可选参数 我也不知道怎么办了
bdmh 2012-12-18
  • 打赏
  • 举报
回复
调用约定一致吗, [DllImport(@"BaseEn.dll",CallingConvention= CallingConvention.Cdecl)]

110,556

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • Web++
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧