-
Notifications
You must be signed in to change notification settings - Fork 14
/
USAGE.txt
50 lines (35 loc) · 1.41 KB
/
USAGE.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
Using Fwrap
===========
1. Ensure you have all the requirements installed (see README.txt).
2. Ensure that the tests pass (see README.txt).
3. Install fwrap or set up your PYTHONPATH accordingly (see
INSTALL.txt).
Suppose you have a fortran source file `source.f90` and you would
like to generate wrappers for every procedure in it along with an
extension module.
You can check and see what fortran compilers fwrap can find:
$ fwrapc --help-fcompiler
If it can't find your compiler, you'll need to give it some help:
$ fwrapc --help-fcompiler --fcompiler=<vendor name> \
--f90exec=/path/to/executable
If it still cannot find your compiler, please email the user's list
for assistance.
Assuming it can find your compiler, you would generate wrappers and
an extension module with this command:
$ fwrapc source.f90 --build \
--name=test_fw --fcompiler=gnu95 \
--f90exec=/path/to/executable \
-L/path/to/runtime/libs -l<libname>
This will create a directory ./test_fw and place the wrapper files
there, along with an extension module `test_fw.so` (the file
extension is platform dependent).
From within Python:
>>> import test_fw
>>> help(test_fw)
>>> # ...
>>> # for subroutine bessel inside test_fw
>>> help(test_fw.bessel)
>>> # ...
The generated docstrings are viewable with the 'help' builtin
function and should suffice for using the extension module from
Python.