C# LoadLibrary issue

Kady_Shi施冠成 0 信譽點數
2024-05-16T11:05:33.6666667+00:00

In C#, I imported the C DLL through LoadLibrary.

In .net3.5 I used Marshal.PtrToStructure to convert the pointer back to the structure

I successfully get int map_num equal to 1

But when I run .net4.8, I get 0x00007ffb. Why is this?

public struct _map_name_usr_param_t

{

public IntPtr ver_str;

public UInt32 ver;

}

[StructLayout(LayoutKind.Sequential, Pack = 2)]

public struct _map_list_usr_param_t

{

public int map_num;

[MarshalAs(UnmanagedType.ByValArray)]

public _map_name_usr_param_t[] maps;

}

開發人員技術 | C#
開發人員技術 | C#
物件導向且型別安全的程式設計語言,源自 C 語言系列,並包括支援元件導向程式設計的功能。
0 則留言 沒有留言
{count} 則投票

您的回答

答案可由問題作者標示為「已接受」,而由仲裁者標示為「推薦」,這可協助使用者知道答案解決了作者的問題。