我在R中使用rClr包从第三方dll中提取方法。我的代码中有以下错误。
> clrGetMemberSignature(ch, 'getTimeIntensityPairs')
[1] "Method: Void getTimeIntensityPairs, TimeIntensityPairList&"
> ch_data <- clrNew('pwiz.CLI.msdata.TimeIntensityPairList')
> ch_data
An object of class "cobjRef"
Slot "clrobj":
<pointer: 0x0000000030d9d860>
Slot "clrtype":
[1] "pwiz.CLI.msdata.TimeIntensityPairList"
> clrCall(ch, 'getTimeIntensityPairs', ch_data)
Error in clrCall(ch, "getTimeIntensityPairs", ch_data) :
Type: System.MissingMethodException
Message: Could not find a suitable instance method getTimeIntensityPairs on type pwiz.CLI.msdata.Chromatogram for method parameters TimeIntensityPairList
Method: Void ThrowMissingMethod(System.Type, System.String, System.String, System.Type[])
Stack trace:
at Rclr.ReflectionHelper.ThrowMissingMethod(Type classType, String methodName, String modifier, Type[] types) in c:\Users\hhusl\AppData\Local\Temp\RtmpWMoV35\R.INSTALL337439456109\rClr\src\ClrFacade\ReflectionHelper.cs:line 785
at Rclr.ClrFacade.InternalCallInstanceMethod(Object obj, String methodName, Boolean tryUseConverter
所以ch
有一个方法:void getTimeIntensityPairs(TimeIntensityPairList&)
。使用rClr
,我能够构建TimeIntensityPairList
类型的obj(在我的情况下为ch_data
),但是如何生成引用的版本TimeIntensityPairList&
并让它传递类型检查?