[Mono-list] Interop - PreserveSig

lx42 fasterlu at hotmail.com
Sat Oct 3 22:25:36 UTC 2015


I have something like below from the managed side: 
        [DllImport("MyTest", PreserveSig=false)] 
        public static extern void Test3(); 

On the native side it looks like: 

HRESULT Test3() 
{ 
        return E_ABORT; 
} 

However when calling it, I am not  getting an exception like what I got with
.NET interop. 

More seriously, if I want to return something, for example: 

        [DllImport("MyTest", PreserveSig = false)] 
        public static extern int Test5(); 


HRESULT Test5(int* result) 
{ 
        *result = 1; 
        return S_OK; 
} 

The result parameter I got is an invalid address and therefore when saving
the value to the address it can have undefined behavior. 

So my question is, does mono respect PreserveSig? 

Thanks 



--
View this message in context: http://mono.1490590.n4.nabble.com/Interop-PreserveSig-tp4666682.html
Sent from the Mono - General mailing list archive at Nabble.com.


More information about the Mono-list mailing list