I have a 64-bit .dll with its .lib compiled by Visual Studio 2022. The subroutine, called DLLTEST, adds two 4-byte integers into a third 4-byte integer. Dumpbin.exe reports that all is as expected…
Xojo compiles, but when I try to use the .dll in a 64-bit Xojo app, there is this error message:
“… DLLTEST.lib is either not designed to run on Windows or it contains an error … error status 012f”
The Xojo External Method matches the .dll. Here is the method:
Method: DLLTEST
Parameters: byref in1 as integer, byref in2 as integer, byref out1 as integer
Return type: blank (this .dll is a subroutine)
Lib: DLLTEST.Lib
(have also tried SOFT DECLARE SUB)
Here is the VS2022 code. It is Intel IFORT Fortran:
subroutine DLLTEST (IN1, IN2, OUT1)
!DEC$ ATTRIBUTES DLLEXPORT::DLLTEST
!DEC$ ATTRIBUTES REFERENCE:: IN1, IN2, OUT1
integer*4 IN1, IN2, OUT1
OUT1 = IN1 + IN2
end
I have tried variables byref and byvalue, and also compiled the routine as a subroutine and a function, with matching Xojo external methods. Always the same error message.
I have a 2022 Visual Studio Github project that creates the AddTwo dll from Visual Studio, and when the dll is placed in the example Xojo plugin folder, it compiles and runs properly in 64-bit mode.
Visual Studio 2022
Xojo 2023 R4
Windows 11
Here is the link to the github project with Visual Studio 2022 code and the example Xojo program: