- Stochastic processes for epidemiology
- Computational demography
- Distributed, parallel, high-performance computing
- Provenance systems
adolgert / fortlua Goto Github PK
View Code? Open in Web Editor NEWExample of Calling Lua from Fortran
Example of Calling Lua from Fortran
I've been able to build Lua as a standalone executable with MSVC on Windows and create static and dynamic libraries using the LIB.EXE tool (Lua 5.3.2 sources taken from the Aotus project and the build process was modified from http://blog.spreendigital.de/2015/01/16/how-to-compile-lua-5-3-0-for-windows/). I've been able to compile the Fortran code with ifort on Windows but problem comes in when I try to link the Fortran .obj files with the C .lib files.
Running
ifort /I..\lua-5.3.2\src config.f90 program.f90 ..\lua-5.3.2\src\lua5.3.2-static.lib /exe:fortlua_test.exe
gives the fairly common error:
LINK : warning LNK4098: defaultlib 'MSVCRT' conflicts with use of other libs; use /NODEFAULTLIB:library
and barfs up a lot of errors regarding multiply- and never- defined symbols.
The problem seems to be with the options passed through to the linker as well as with the way the C libraries were originally built/packaged. I've successfully built Aotus on both Linux and Windows with gcc & gfortran and on Linux with ifort and gcc, but I cannot make any headway with MSVC and ifort on Windows, either with Aotus or FortLua. I switched my attention from Aotus to FortLua because FortLua is much simpler; if the Windows linking issues could be solved for FortLua, the same solution should be applicable for Aotus as well.
I have no guarantee my Lua libs were properly built for library use or packaged properly; I'm neither a C developer nor a Windows developer so please take that into account. A lot of the build process is cargo-cultish, modifying other people's work until it stops throwing errors but without understanding the underlying gratuitous Byzantine complexity of the Microsoft ecosystem (Linux is slightly less bad, but I can at least make the tools work on my own. Eventually.)
Anyway, could you assist in helping build FortLua on Windows with ifort and MSVC? I have access to a licensed version of Windows ifort at work; MSVC can be obtained from MS via their Visual Studio Express downloads (though don't ask me what the difference between VS2010, VS2013, etc. is; apparently the specific version can make a big difference but nobody can clearly explain why one should choose one over another. As I said, gratuitous Byzantine complexity...)
I'm in the process of writing up a substantial article (blog post, etc) on integrating Lua and Fortran and the last missing piece is getting Lua & Fortran working together on Windows using the standard commercial toolchain. Any help you could provide would be very greatly appreciated.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.