お世話になります。
C#からDLLの関数を実行した時にエラーが発生してしまいます。
エラー原因や怪しそうなところがありましたら教えてください。
また「保護されているメモリに読み取りまたは書き込み操作を行おうとしました。他のメモリが壊れていることが考えられます。」というエラーはどういった時に発生しますでしょうか?
【ソース】
BioAPI_IdentifyMatchで以下のエラーがでます。
C#
1BioAPI_HANDLE ModuleHandle = 0; 2BioAPI_FAR MaxFARRequested = null; 3BioAPI_FRR MaxFRRRequested = null; 4BioAPI_BOOL FARPrecedence = null; 5BioAPI_INPUT_BIR ProcessedBIR = null; 6BioAPI_IDENTIFY_POPULATION Population = null; 7BioAPI_BOOL Binning = null; 8uint MaxNumberOfResults; 9uint NumberOfResults; 10BioAPI_CANDIDATE [] Candidates = null; 11int Timeout = 30000 12 13BioAPI_RETURN bReturn = BioAPI_RETURN.BioAPI_ERRCODE_INTERNAL_ERROR; 14IntPtr ptrMaxFRRRequested = IntPtr.Zero; 15BioAPI_INPUT_BIR_Marshal mProcessedBIR = null; 16IntPtr ptrCandidates = IntPtr.Zero; 17if (MaxFRRRequested >= (BioAPI_FRR) 0) 18{ ptrMaxFRRRequested = BioAPIWin32.MarshalInt32((int) MaxFRRRequested); } 19if (ProcessedBIR != null) 20{ mProcessedBIR = new BioAPI_INPUT_BIR_Marshal(ProcessedBIR); } 21 22bReturn = BioAPIWin32.BioAPI_IdentifyMatch( 23 ModuleHandle, 24 ref MaxFARRequested, 25 ptrMaxFRRRequested, 26 ref FARPrecedence, 27 mProcessedBIR, 28 ref Population, 29 Binning, 30 MaxNumberOfResults, 31 ref NumberOfResults, 32 ptrCandidates, 33 Timeout);
■BioAPI_IdentifyMatchの定義
C#
1[DllImport("bioapi100.dll")] 2public static extern BioAPI_RETURN BioAPI_IdentifyMatch( 3 BioAPI_HANDLE ModuleHandle, ref BioAPI_FAR MaxFARRequested, 4 IntPtr ptrMaxFRRRequested, ref BioAPI_BOOL FARPrecedence, 5 BioAPI_INPUT_BIR_Marshal ProcessedBIR, 6 ref BioAPI_IDENTIFY_POPULATION Population, 7 BioAPI_BOOL Binning, 8 uint MaxNumberOfResults, 9 [In, Out]ref uint NumberOfResults, 10 [In, Out] IntPtr ptrCandidates, 11 int Timeout);
Cの仕様
C
1BioAPI_RETURN BioAPI BioAPI_IdentifyMatch ( 2BioAPI_HANDLE ModuleHandle, 3const BioAPI_FAR *MaxFARRequested, 4const BioAPI_FRR *MaxFRRRequested, 5const BioAPI_BOOL *FARPrecedence, 6const BioAPI_INPUT_BIR *ProcessedBIR, 7const BioAPI_IDENTIFY_POPULATION *Population 8BioAPI_BOOL Binning, 9uint32 MaxNumberOfResults, 10uint32 *NumberOfResults, 11BioAPI_CANDIDATE_ARRAY_PTR *Candidates, 12sint32 Timeout 13);
【追加質問】
PopulationとNumberOfResultsがポインタになっているにも関わらずDllimportではrefになっていますが、良いでしょうか?
回答1件
あなたの回答
tips
プレビュー