本帖最后由 xi_aowo_happy 于 2011-12-27 14:26:48 编辑

解决方案 »

  1.   

    [DllImport("madlldlib.dll")]这样貌似调用api你可以将dll放到system32下如果文件在你的在程序中你可以添加引用dll
      

  2.   

    如果我单纯地把struct mad_header *mhdr改成IntPtr mhdr则运行时提示
    A first chance exception of type 'System.AccessViolationException' occurred in proj.exe
            
            public delegate void CbDelegate(ulong fcnt,ulong bcnt, IntPtr mhdr);
            public void mycb(ulong  fcnt, ulong bcnt,IntPtr mhdr) 
            {
                //some codes
        
            }
      

  3.   

    现在的问题是参数如何改成C#的对应形式,调用的CbMpegAudioDecoder函数也能执行一部分,但就是不能正常执行结束。
      

  4.   

    这样使用:      public delegate void CbDelegate(uint fcnt,uint bcnt, ref mad_header mhdr);        [DllImport("madlldlib.dll")]
            public static extern int CbMpegAudioDecoder(
                                                string InFN,
                                                string OutFN,
                                                int WavPad,
                                                string StatMsg,    
                                                StringBuilder pfunc 
                                            );
    另外,你要把那个结构体mad_header,在C#这边声明!
      

  5.   

    这样使用:      public delegate void CbDelegate(uint fcnt,uint bcnt, ref mad_header mhdr);        [DllImport("madlldlib.dll")]
            public static extern int CbMpegAudioDecoder(
                                                string InFN,
                                                string OutFN,
                                                int WavPad,
                                                StringBuilder StatMsg,    
                                                CbDelegate pfunc 
                                            );
    另外,你要把那个结构体mad_header,在C#这边声明!
      

  6.   

    这样使用:      public delegate void CbDelegate(uint fcnt,uint bcnt, ref mad_header mhdr);        [DllImport("madlldlib.dll")]
            public static extern int CbMpegAudioDecoder(
                                                string InFN,
                                                string OutFN,
                                                int WavPad,
                                                StringBuilder StatMsg,    
                                                CbDelegate pfunc 
                                            );
    另外,你要把那个结构体mad_header,在C#这边声明!
      

  7.   

    自己搞定了,哈哈。原来调用方法没问题,是参数类型的事。应该把unsigned long改成uint - -!
      

  8.   


          public delegate void CbDelegate(uint fcnt,uint bcnt, ref mad_header mhdr);        [DllImport("madlldlib.dll")]
            public static extern int CbMpegAudioDecoder(
                                                string InFN,
                                                string OutFN,
                                                int WavPad,
                                                StringBuilder StatMsg,    
                                                CbDelegate pfunc 
                                            );
    另外,你要把那个结构体mad_header,在C#这边声明!
      

  9.   

    不知怎么搞的,今天下午老是回复不了!      public delegate void CbDelegate(uint fcnt,uint bcnt, ref mad_header mhdr);        [DllImport("madlldlib.dll")]
            public static extern int CbMpegAudioDecoder(
                                                string InFN,
                                                string OutFN,
                                                int WavPad,
                                                StringBuilder StatMsg,    
                                                CbDelegate pfunc 
                                            );
    另外,你要把那个结构体mad_header,在C#这边声明!
      

  10.   


          public delegate void CbDelegate(uint fcnt,uint bcnt, ref mad_header mhdr);        [DllImport("madlldlib.dll")]
            public static extern int CbMpegAudioDecoder(
                                                string InFN,
                                                string OutFN,
                                                int WavPad,
                                                StringBuilder StatMsg,    
                                                CbDelegate pfunc 
                                            );
    另外,你要把那个结构体mad_header,在C#这边声明!
      

  11.   

    madlldlib.dll你在哪里下载的啊, 我找了好久都找不到