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 系列語言,並包含元件導向程式設計的支援。
7 個問題
0 則留言 沒有留言
{count} 則投票