[DllImport("libvlc")]
        private unsafe static extern void libvlc_media_player_set_hwnd(CoreHandle coreHandle, void* drawable);
错误 2 不安全代码只会在使用 /unsafe 编译的情况下出现
 //设置父窗口 
        unsafe public void VedioSetParent(CoreHandle coreHandle, IntPtr hear)
        {
            libvlc_media_player_set_hwnd(coreHandle, (hear.ToPointer()));
        }
错误 1 不安全代码只会在使用 /unsafe 编译的情况下出现 错误在于void* drawable 进行了强转 在xxx.dll里 接口为
/**
 * Set a Win32/Win64 API window handle (HWND) where the media player should
 * render its video output. If LibVLC was built without Win32/Win64 API output
 * support, then this has no effects.
 *
 * \param p_mi the Media Player
 * \param drawable windows handle of the drawable
 */
LIBVLC_API void libvlc_media_player_set_hwnd ( libvlc_media_player_t *p_mi, void *drawable );
怎么实现C#代码的修改啊...

解决方案 »

  1.   

    libvlc_media_player_t是一个结构体吧,你把它先贴出来
      

  2.   

    为什么用unsafe呢??
    [DllImport("libvlc")]
    public static extern void libvlc_media_player_set_hwnd(CoreHandle coreHandle, IntPtr drawable);
      

  3.   

    正确做法:[DllImport("libvlc")]
    public static extern void libvlc_media_player_set_hwnd(ref libvlc_media_player_t p_mi, IntPtr drawable);
      

  4.   

    可以在定义前用unsafe标识:
    unsafe class xx
    {
    [DllImport("libvlc")]
    public static extern void libvlc_media_player_set_hwnd
      ...
    }
    编译设置中勾上 允许使用不安全代码.
      

  5.   

    CoreHandle,libvlc_media_player_t这两个都是自定义类型吧?
      

  6.   

    嗯 类型没问题  现在是那个什么从新开启了窗口 hardware YUV overlay directX output 就是这个...