C# 调用dll结构指针 Attempted to read or write protected memory.

cthzr cthzr 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区
C#中调用win32 dll库,如下
[DllImport("NetLib.dll", CharSet = CharSet.Ansi)]
public static extern uint HI_NET_DEV_StartStream(uint lHandle, ref HI_S_STREAM_INFO struStreamInfo);

其函数原型为:
u32 NETSDK_APICALL HI_NET_DEV_StartStream(HI_U32 u32Handle, HI_S_STREAM_INFO* pstruStreamInfo);
HI_S_STREAM_INFO为一个结构体
public struct HI_S_STREAM_INFO
{
public uint u32Channel; /*通道号 */
public uint blFlag; /*HI_TRUE:连接主码流,HI_FALSE:连接次码流*/
public uint u32Mode; /*网络连接模式*/
public byte u8Type; /*流数据类型,视频,音频,其他数据*/
};
然后我在C#代码中写的程序运行如下代码后报错:
result = HI_NET_DEV_StartStream(lHandle, ref struStreamInfo);


An unhandled exception of type 'System.AccessViolationException' occurred in Monitor.exe

Additional information: Attempted to read or write protected memory. This is often an indication that other memory is corrupt.

求大神帮忙,在线等


...全文

相关推荐

【ASP.NET编程知识】.Net Core中使用ref和SpanT提高程序性能的实现代码.docx

【ASP.NET编程知识】.Net Core中使用ref和SpanT提高程序性能的实现代码.docx

mmoo_python

C#通过WIN32API获取外部程序sysListview的值和TreeView的值.pdf

C#通过WIN32API获取外部程序sysListview的值和TreeView的值.pdf

资料大全

BobBuilder_app

Twitter Digg Facebook Del.icio.us Reddit Stumbleupon Newsvine Technorati Mr. Wong Yahoo! Google Windows Live Send as Email Add to your CodeProject bookmarks Discuss this article 85 Print Article Database » Database » Other databasesLicence CPOL First Posted 19 Jan 2012 Views 24,219 Downloads 992 Bookmarked 74 times RaptorDB - The Key Value Store V2 By Mehdi Gholam | 8 Mar 2012 | Unedited contribution C#.NETDBABeginnerIntermediateAdvanceddatabase Even faster Key/Value store nosql embedded database engine utilizing the new MGIndex data structure with MurMur2 Hashing and WAH Bitmap indexes for duplicates. See Also More like this More by this author Article Browse Code Stats Revisions (8) Alternatives 4.95 (56 votes) 1 2 3 4 5 4.95/5 - 56 votes μ 4.95, σa 1.05 [?] Is your email address OK? You are signed up for our newsletters but your email address is either unconfirmed, or has not been reconfirmed in a long time. Please click here to have a confirmation email sent so we can confirm your email address and start sending you newsletters again. Alternatively, you can update your subscriptions. Add your own alternative version Introduction What is RaptorDB? Features Why another data structure? The problem with a b+tree Requirements of a good index structure The MGIndex Page Splits Interesting side effects of MGIndex The road not taken / the road taken and doubled back! Performance Tests Comparing B+tree and MGIndex Really big data sets! Index parameter tuning Performance Tests - v2.3 Using the Code Differences to v1 Using RaptorDBString and RaptorDBGuid Global parameters RaptorDB interface Non-clean shutdowns Removing Keys Unit tests File Formats File Format : *.mgdat File Format : *.mgbmp File Format : *.mgidx File Format : *.mgbmr , *.mgrec History Download RaptorDB_v2.0.zip - 38.7 KB Download RaptorDB_v2.1.zip - 39 KB Download RaptorDB_v2.2.zip - 39 KB Download RaptorDB_v2.3.zip - 39.6 KB D

YANJIN050518

Visual.C++.NET托管扩展编程英文版

The most immediately obvious feature of .NET is the runtime, which Microsoft calls the common language runtime. The concept of a runtime is not new to Microsoft technologies—Visual Basic applications have always carried around the baggage of the Visual Basic runtime, and Microsoft’s foray into Java brought about the Microsoft Java Virtual Machine (JVM). But unlike the Visual Basic runtime and the JVM, the .NET runtime is not constrained to a specific language. Both Microsoft and third-party companies have produced several languages that can produce code to run under the .NET runtime. Some, such as C#, are new languages, and others use the syntax of existing languages. Microsoft Visual C++ .NET is an existing language that has been extended to produce .NET code, and these extensions are called the Managed Extensions for C++. The Managed Extensions allow C++ classes to take advantage of .NET garbage collection and memory protection. More important, they enable C++ code to access the .NET Framework class library and libraries written by any of the other .NET-enabled languages; and other languages can use managed libraries written in C++. No longer do C++ developers need to use myriad technologies such as COM, DLL exported functions, and template libraries to get access to the libraries they need to create a fully featured application; just about all the necessary library code is available as .NET classes in the .NET Framework class library. The Managed Extensions essentially define a subset of the C++ language—it looks like C++, and it smells like C++, but it is really .NET. You might be asking yourself, “If .NET allows me to choose between a multitude of languages, why should I use C++ to write my .NET code?” C++ has always been a systems language, and it gives you the power and flexibility to produce truly innovative solutions. This ethos has been carried over to the Managed Extensions, in which you have not only the complete features of the .NET runtime and class

virgil0236

【机械故障诊断】基于周期冲击分段与能量特征提取的压缩机阀片故障识别系统设计 MATLAB 压缩机阀片故障识别|周期冲击分段与能量特征提取

内容概要:通过MATLAB实现压缩机阀片故障识别,采用周期冲击分段与能量特征提取相结合的技术路线。首先对接收的振动信号进行质量控制与预处理,利用包络解调和自相关函数估计主要冲击周期,并通过相位对齐完成周期样本构造。在此基础上,构建包含时域、包络域、频域和非线性能量域的五维紧凑特征,用于表征不同故障状态。最终采用树集成分类模型实现多状态故障的自动识别,并通过分层部署架构支持离线分析与在线监测。整个系统强调机理与数据的深度融合、质量控制与防信息泄漏设计,适用于多种工业场景。 适合人群:具备一定信号处理与机器学习基础知识,从事工业设备状态监测、故障诊断或预测性维护的研发人员和工程师。 使用场景及目标:①实现往复式压缩机阀片从正常到严重损伤的多状态故障精准识别;②在强噪声、工况变化和转速波动环境下提升故障诊断的鲁棒性和准确性;③构建可追溯、可部署、可持续维护的工业级设备健康监测系统,服务于石油化工、天然气输送、制冷与高压气体系统等领域。 阅读建议:此资源提供了完整的MATLAB可执行工程实现,建议结合提供的GUI界面与代码示例,从数据模拟、信号处理、特征提取到模型训练与评估进行全流程实践。重点关注周期分段的物理意义、多域特征的构建逻辑以及模型部署中的防泄漏设计,以深入理解其工程应用价值。

nantangyuxi
评论 7
收藏 已收藏
分享
返回顶部
cthzr
C# 111,130 成员 642,540 内容