放到当前程序目录中,DLLIMPORT, 申明为外部函数,就可以调用了

解决方案 »

  1.   

    public RTD_Program(int comPort,StringBuilder str)
            {
                _comPort = comPort;
                _strFile = new StringBuilder();
                _strFile = str;
                //_flashaddr = \Xff000;
            }
            //[DllImport("debugtools_library.dll", EntryPoint = "SetHDCP_CODE")]
            [DllImport("debugtools_library.dll")]
            private static extern long RtdProgram
                (
                int comport, 
                ref StringBuilder strFile, 
                UInt32 flashaddr, 
                int mode
                );
            //[DllImport("debugtools_library.dll", EntryPoint = "GetHDCP_CODE")]
            [DllImport("debugtools_library.dll")]
            private static extern long RtdRead
                (
                int comport,
                UInt32 flashaddr,
                UInt32 length,
                ref StringBuilder strFile //unsigned 
                );
            public long Write_HDCP()
            {
                retval = RtdProgram(_comPort, ref _strFile, 0xff000, 2);
                return retval;
            }
            public StringBuilder Read_HDCP()
            {
                RtdRead(_comPort, 0xff000, 320, ref _strBuff);
                return _strBuff;
            }
    再執行public long Write_HDCP()的時候報錯
    在DLL'debugtools_library.dll中找不到RtdProgram進入點
    dll函數接口
    __declspec(dllexport) long RtdProgram(int comport, char* strFile, UINT32 flashaddr, int mode);
    __declspec(dllexport) long RtdRead(int comport, UINT32 flashaddr, UINT32 length, unsigned char* getData);