参照設定にDLLを追加し、以下のようなコードを書きました。
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
namespace cli_test
{
class Program
{
static void Main(string[] args)
{
AttacheCase.Unlocker unlocker = new AttacheCase.Unlocker();
FileStream infs = new FileStream("test.atc", FileMode.Open);
int[] key = new int[] {};
unlocker.open(infs, key);
}
}
}
C++/CLI側のヘッダはエラー CS0122: 'AttacheCase.Unlocker.open(System.IO.Stream, int[])' はアクセスできない保護レベルになっています。
using namespace System;
namespace AttacheCase {
public ref class Unlocker
{
public:
Unlocker();
~Unlocker();
public:
ATCResult open(Stream ^src, array<int>^ key);
ATCResult close();
size_t getEntryLength();
ATCResult getEntry(ATCFileEntry *entry, size_t index);
ATCResult extractFileData(ostream *dst, istream *src, size_t length);
public:
int32_t data_version();
char data_sub_version();
int32_t algorism_type();
char passwd_try_limit();
bool self_destruction();
private:
ATCUnlocker_impl *impl_;
};
}
念のためC#のオブジェクトブラウザを使ってDLLを見てみましたが、ちゃんとpublicな関数として登録されています。
C++/CLIとC#に関する知識が浅いので原因がよく分からないのですが、
プロジェクトを添付しておきましたので同じようなエラーが出るかどうか確かめていただけないでしょうか。
Visual C# 2010 のプロジェクトとビルド済みのDLLが入っています。C++/CLIのプロジェクトは入っていません。
特に設定なしにビルドを開始できると思います。