Skip to content

Instantly share code, notes, and snippets.

View baptistelabat's full-sized avatar

Baptiste Labat baptistelabat

  • Nautilabs
  • Nantes, France
View GitHub Profile
@baptistelabat
baptistelabat / compile.bat
Last active June 16, 2016 13:44
Basic example of how to call c++ code from fortran
gcc -c test.cpp -o test.o
gfortran main.f90 test.o
a
@baptistelabat
baptistelabat / compile.bat
Last active March 27, 2022 12:50
How to compile and access a c++ dll from c++ (taken from http://www.mingw.org/wiki/sampledll)
rem You need to have g++ and gfortran installed (for example, use MinGW and add the bin repertory to your path).
rem Build the example_dll.dll
g++ -c -DBUILDING_DLL example_dll.cpp
rem .a is needed for gfortran compiler
g++ -shared -o example_dll.dll example_dll.o -Wl,--out-implib,libexample_dll.a
rem .lib is needeede by ifort compiler (but it is the same file)
copy libexample_dll.a libexample_dll.lib
rem del libexample_dll.a
g++ -c test.cpp -o test.o
@baptistelabat
baptistelabat / mouseLog10Hz.html
Last active April 17, 2017 18:48
Small example of a log generated at 10Hz from mouse position that you can then save to your computer;
<html>
<body>
<button onclick="saveTextAsFile()">Save Text to File</button>
<script type="text/javascript">
// Inspiration from https://thiscouldbebetter.wordpress.com/2012/12/18/loading-editing-and-saving-a-text-file-in-html5-using-javascrip/
var textToSave = "Date, clientX, clientY" + String.fromCharCode(13); // Header of log file
var clientX = 0;
var clientY = 0;