Help wanted calling DLLs from 64-bit versions of Excel

Help wanted calling DLLs from 64-bit versions of Excel

I am calling a Fortran DLL from Excel VBA, and have ben doing so successfully for years.

Now one of our engineering suppliers is using a 64-bit version of Office (we haven't migrated from Office 2007 yet).

Can someone help me with my interfaces?

I am using calls like

Private Declare Sub ApproxBayerDensity_F Lib "AHEAProps.dll" (TempC As Double, Value As Double, ByVal Units As String)

Call ApproxBayerDensity_F(T, Value, Units)

the Fortran side is like

Subroutine ApproxBayerDensity_F(TempC, Value, Units)

!DEC$ ATTRIBUTES DLLEXPORT, STDCALL, ALIAS:'ApproxBayerDensity_F' :: ApproxBayerDensity_F

!DEC$ ATTRIBUTES REFERENCE :: Units

...

IMPLICIT NONE

Real (KIND=8),INTENT(IN) :: TempC(1)

Real (KIND=8),INTENT(OUT) :: Value(1)

Character (LEN=20),INTENT(INOUT) :: Units

...

For the 64-bit interface, I now need to use

Private Declare PtrSafe Sub ApproxBayerDensity_F Lib "AHEAProps.dll" (TempC As Double, Value As Double, ByVal Units As String)

Where the variables have to be compatible with the 64-bit Excel. 

 

Do I need to change anything on the Fortran side?

 

Thanks,

David

publicaciones de 4 / 0 nuevos
Último envío
Para obtener más información sobre las optimizaciones del compilador, consulte el aviso sobre la optimización.

I don't see anything that has to change on the Fortran side.The STDCALL won't have any effect in this case (you've effectively overridden the effects it would have on x64), but that's harmless.

Steve - Intel Developer Support

Thanks. Steve. What about integer values? On the VBA side, these are now defined as LongPtr instead of Long. Do these still map OK to INTEGER?

thanks,

David

LongPtr would be INTEGER(8) on x64.

Steve - Intel Developer Support

Deje un comentario

Por favor inicie sesión para agregar un comentario. ¿No es socio? Únase ya