Bonjour,

Je suis entrain de convertir un projet C en C#

Originale :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#pragma pack(push,1)
typedef struct {
	int sizecb;
	HWND hWnd;
	struct {
		char *idopen;
		char *soft;
		int highver;
		int lowver;
		bool showerror;
		void *ext;
	}in_open;
	struct {
		void *defaut;
		void *software;
		void *param;
	}io_info;
	struct {
		bool releaseafteropen;
	}misc;
	struct {
		DWORD errmaster;
		DWORD errchild;
	}out_error;
	HANDLE (_stdcall *load)(void *param,HWND hWnd,int sizemaster,void *master,int sizechild,void *child,char *password,void *infomaster,void *infochild,DWORD *errmaster,DWORD *errchild);
}TOPENGLICS_APILOAD,*POPENGLICS_APILOAD;
#pragma pack(pop)
C# :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
namespace demo_realtimesolution
{
    class openglics
    {
        IntPtr hLic;
        //[System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)]
         IntPtr emuleload(IntPtr param,IntPtr hWnd,int sizemaster,IntPtr master,int sizechild,IntPtr child,IntPtr password,IntPtr infomaster,IntPtr infochild,ref UInt32 errmaster,ref UInt32 errchild)
        {
 
	        return IntPtr.Zero;
        }
        [System.Runtime.InteropServices.StructLayout(System.Runtime.InteropServices.LayoutKind.Sequential,
    Pack = 1)]
        public unsafe struct in_open
        {
            public char* idopen;
            public char* soft;
            public UInt32 highver;
            public UInt32 lowver;
            public bool showerror;
            public void* ext;
        }
        public unsafe struct io_info
        {
            public void* defaut;
            public void* software;
            public void* param;
        }
        public unsafe struct misc
        {
            public bool releaseafteropen;
        }
        public unsafe  struct out_error
        {
            public UInt32 errmaster;
            public UInt32 errchild;
        }
        public unsafe struct OPENGLICS_APILOAD
        {
            public int sizecb;
	        public IntPtr hWnd;
            public in_open varin_open;
            public io_info vario_info;
            public misc var_misc;
            public out_error var_outerror;
 
            [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)]
            public delegate IntPtr loadlicense(IntPtr param, IntPtr hWnd, int sizemaster, IntPtr master, int sizechild, IntPtr child, char* password, void* infomaster, void* infochild, ref UInt32 errmaster, ref UInt32 errchild);
            public loadlicense li;
 
        }
        void LoadLicense()
        {
            unsafe
            {
 
                OPENGLICS_APILOAD on = new OPENGLICS_APILOAD();
                //on.sizecb = on.s           
                on.varin_open.idopen = null;
                on.varin_open.highver = 1;
                on.varin_open.lowver = 3;
                on.varin_open.showerror = true;
               // char[] soft=string.to
                on.varin_open.soft =  (char*)(void*)System.Runtime.InteropServices.Marshal.StringToHGlobalAnsi("STRING");
 
                //apiload.io_info.defaut = &lic_solumaze;
                on.vario_info.defaut = null;
                on.li = emuleload; //INTERESSANT ICI !!! ERREUR CS0123
 
            }
 
 
        }
    }
}
Pouvez-vous m'aider ?

Je m'explique , je vais passer cette structure nommé "on" à ma DLL ecrite en C , et la fonction on.li de C# doit être appeler par ma DLL.

J'ai l'erreur de compilation :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
error CS0123: No overload for 'emuleload' matches delegate 'demo_realtimesolution.openglics.OPENGLICS_APILOAD.loadlicense
Merci