So I entered the following VBA code and stepped through it: Sub RunIt()ĭim Val1 As Integer, Val2 As Integer, Sum As IntegerĪs expected, it blew up on Sum =, with one of MS's more useless error messages "Error in loading DLL (Error 48)". It declared AddIt as follows: Declare PtrSafe Function AddIt Lib "C:\A\Projects\gTest\Output\gTest.dll"(iVal1 As Integer, iVal2 As Integer) As Integer I set up a little spread sheet, gTest.xlsm, which tried to invoke AddIt. This produced no output, but did write the file gTest.dll.Īnd so onto Excel / VBA. , after adding the path to the MinGW bins added to %PATH% gfortran -Wextra -Wall -pedantic -shared -fPIC -o. I compiled it as follows, from directory. (The second line specifies Microsoft attributes. !MS$ATTRIBUTES dllexport, stdcall, alias:'AddIt' :: ADDIT Here is the Fortran source code, in a file called gTest.F90: integer(2) function AddIt(iVal1,iVal2) So I downloaded gFortran as part of MinGW-w64-for 32 and 64 bit Windows from SourceForge. For years I used a combination of dlls written in Fortran PowerStation and Excel 02/03, with VBA 6.īut progress marches on, and I got a new machine with Windows 64 bit, Excel 365 (64 bit), and no Fortran.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |