Datatype Conversion Error

Add-in Express™ Support Service
That's what is more important than anything else

Datatype Conversion Error

Posts: 1
Joined: 2014-09-01
I want use xtrfun.dll and some of parameters use the Long data type

This dll works in excel VBA with Long data type

But my xll program return error massage

How can I use this dll in my xll program as udf ?

My source code

'long __stdcall xtf_Interpolate(
' double * Xs ,
' double * Ys ,
' long npts ,
' double X ,
' double * Y ,
' signed short Parabolic ,
' signed short Averaging ,
' double Power ) ;
Public Declare Function xtf_Interpolate Lib "XtrFun.dll" (
dGivenXs As Double,
dGivenYs As Double,
ByVal lNumberOfPoints As Long,
ByVal dInterpolateYAtThisX As Double,
dReturnedInterpolatedY As Double,
ByVal nParabolic As Integer,
ByVal nAveraging As Integer,
ByVal dPower As Double
) As Long

'long __stdcall xtf_PFit(
' double * pdArrayOfIndependentVariables ,
' double * pdArrayOfObservedYs ,
' long lNumberOfObservations ,
' double dGivenX ,
' long lOrder ,
' double * pdPolynomialFitY ) ;
Public Declare Function xtf_PFit Lib "XtrFun.dll" (
dGivenXs As Double,
dGivenYs As Double,
ByVal lNumberOfPoints As Long,
ByVal dReturnPFitYAtThisX As Double,
ByVal dPFitOrder As Long,
dReturnedPFitY As Double
) As Long

Error Message

Assembly Full Name: AddinExpress.MSO.2005, Version=8.9.4453.0, Culture=neutral, PublicKeyToken=4416dd98f0861965
Assembly Version: 8.9.4453.0

Exception Source: AddinExpress.MSO.2005
Exception Type: System.ApplicationException
Exception Message: Unknown Data Type: System.Int64
Exception Target Site: SetTypeInfo

---- Stack Trace ----
AddinExpress.MSO.ADXExcelParameterInfo.SetTypeInfo(type As Type, isReturnType As Boolean)
AddinExpress.MSO.2005.dll: N 2115 (0x843) IL
AddinExpress.MSO.ADXExcelMethodInfo..ctor(targetMethod As MethodInfo, functions As List`1, modBuilder As ModuleBuilder)
AddinExpress.MSO.2005.dll: N 0540 (0x21C) IL
AddinExpress.MSO.ADXExcelMethodInfo.ConvertToXlMethodInfos(methodInfos As List`1, functions As List`1)
AddinExpress.MSO.2005.dll: N 0000 (0x0) IL
Posted 09 Dec, 2018 19:24:42 Top
Andrei Smolin

Add-in Express team

Posts: 16673
Joined: 2006-05-11
Hello enesg,

The issue occurs because Excel doesn't provide support for Int64; you can see this at That page contains a table that maps a data type used by your XLL function to a symbol (such as A, L, B, or E). Behind the scenes, Add-in Express uses the information from this table to provide Excel with a supported function description. The exception is raised because Int64 (= Long in VB.NET) isn't listed in that table. Try to declare these parameters and the return value as Integer.

Regards from Belarus (GMT+3),

Andrei Smolin
Add-in Express Team Leader
Posted 10 Dec, 2018 05:03:49 Top