How to use unmanaged codes in managed ones.

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hello Esteemed Developers
I face problems using some managed codes in unmanaged ones and vice versa. For exampla I frequently took the following error message. That is
C2440: 'type cast' : cannot convert from 'sockaddr_in __gc*' to 'sockaddr*
O
C2664: 'WSAStartup' : cannot convert parameter 2 from 'WSADATA __gc*' to 'LPWSADATA

I noticed that my problem is converting managed types/codes to unmanged types/codes. I found some web pages about conversion. But those examples or explanations seems to me complex. Marshal is a tecnique to do this conversion

If you kindly forward me to a site, which explains this subject, is also prefereable

I would like to thank you in advance foe your sincere considerations and guidances
 
Alper,
Hello Esteemed Developers,
I face problems using some managed codes in unmanaged ones and vice versa.
For exampla I frequently took the following error message. That is:
C2440: 'type cast' : cannot convert from 'sockaddr_in __gc*' to 'sockaddr*'
OR
C2664: 'WSAStartup' : cannot convert parameter 2 from 'WSADATA __gc*' to 'LPWSADATA'

I noticed that my problem is converting managed types/codes to unmanged
types/codes. I found some web pages about conversion. But those examples or
explanations seems to me complex. Marshal is a tecnique to do this
conversion.
If you kindly forward me to a site, which explains this subject, is also prefereable.

I would like to thank you in advance foe your sincere considerations and
guidances

No need to marshal. Your problem is that you need to pin the objects in
order to be able to pass them to unmanaged code. Look for __pin in the
documentation.,
 
Back
Top