我想创建一个使用ATL的非托管COM DLL,它反映了我以前创建的C#DLL。但是,当我向接口添加方法时,遇到了问题并且无法找到解决方案。为了说明我将包括C#编写的接口:使用ATL的参数类型
public unsafe interface IUserIDA
{
[DispId(1)]
void SwitchCriteria(ref double intensity, ref double minMass, ref double maxMass, ref bool selectIntensity, ref long numOfDepCycles);
[DispId(2)]
void ChargeStateParam(ref short minCharge, ref short maxCharge, ref bool doChargeState);
[DispId(3)]
void InclusionList(ref double intensity, ref double theList, ref short numOfItems);
[DispId(4)]
void ExclusionList(ref long exRTWindow, ref double theMassList, ref long theRTList, ref short numOfItems);
[DispId(5)]
void OtherCriteria(ref long smartFilterTime, ref double isoExclusionWin, ref double massTolerance, ref bool isPPM);
[DispId(6)]
void IsotopeMatchParam(ref double theMassList, ref double theAbundanceList, ref short numOfItems, ref double abTolerance, ref double maTolerance);
[DispId(7)]
void InitIDA();
[DispId(8)]
void SurveySpec();
[DispId(9)]
void NextScan(double* selectedMasses, double* SelectedIntensities, long* selectedCharges, int itemCount);
}当我试图重现这在我的ATL项目(使用Visual Studio 2008),我发现了一些数据类型的不列出:布尔类型和整数类型。应该使用什么类型?
或者我错过了一些东西,或者是这么简单:c#中的布尔值是C++中的布尔值,而c#中的整数值是C++中的int值。它真的是你要求的吗? – Flot2011 2012-02-16 08:06:51
@ Flot2011当我尝试添加方法选项时,有一个选择参数类型的菜单,但我没有看到它的bool *或int *。有variant_bool,但认为是不同的定义。 – Travis 2012-02-16 08:24:46
我还没有使用Visual Studio,这是我第一次使用COM和ATL。当然可以,我可以简单地使用int或bool,但是我不知道并且担心由于可能类型列表中的省略。 – Travis 2012-02-16 08:26:59