Well I've already had some success... I compiled a simple integer add subroutine with gcc 4.6, llvm 3.1, dragonegg 3.1 with the following:
add.F90:
subroutine add(a, b, c) bind(c)
implicit none
integer, intent(in) :: a, b
integer, intent(out) :: c
c = a + b
end subroutine add
After some trial and error, the following command lines seemed to do what was needed:
gcc add.F90 -S -fplugin=dragonegg.so -flto
then invoked the llvm assembler:
llvm-as add.s -o add.o
My test run:
Python 2.7.3 |AnacondaCE 1.2.1 (64-bit)| (default, Nov 20 2012, 22:17:44)
Type "copyright", "credits" or "license" for more information.
IPython 0.13.1 -- An enhanced Interactive Python.
? -> Introduction and overview of IPython's features.
%quickref -> Quick reference.
help -> Python's own help system.
object? -> Details about 'object', use 'object??' for extra details.
In [1]: import ctypes
In [2]: import bitey
In [3]: import add
In [4]: a = ctypes.c_int(1); b = ctypes.c_int(2); c = ctypes.c_int(0)
In [5]: add.add(a,b,c)
In [6]: c
Out[6]: c_int(3)
So far it looks good, the only issue I noticed once I produced the .o correctly is that an underscore is appended to the function name if you neglect the 2003 fortran bind(c) attribute.
- jz