[f2py] I need help on liking external libs

Paulo Teotonio Sobrinho teotonio@fma.if.usp.br
Fri, 22 Feb 2002 11:26:03 -0200 (BRST)


Hi everyone!

My fortran code uses a graphics lib called g2 and looks like this

*file initgraphics.f
*
      subroutine initgraphics
      scale=300.0
******------------------------------------------------------------------
*     Create the virtual device.
******------------------------------------------------------------------
      vdev=g2_open_vd()
******------------------------------------------------------------------
*     Open an X11 window.
******------------------------------------------------------------------
      xdev=g2_open_X11(4.0*scale,3.0*scale)
******------------------------------------------------------------------
*     Associate the two.
******------------------------------------------------------------------
      call g2_attach(vdev,xdev)
******------------------------------------------------------------------
      end
******

When I use it in fortran (program test.f) I link like this

g77 -o test initgraphics.o test.o -L/usr/X11R6/lib -lm -lg2 -lX11 -lgd

Now, I want to to use it in pyhton. What I did was

f2py -c initgraphics.f  -m test -L/usr/X11R6/lib -lm -lg2 -lX11 -lgd

It does not work. What I get is

>>> import test 
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
ImportError: ./test.so: undefined symbol: g2_open_x11_
>

Can some one tell me what is the correct way to wrap my initgraphics.f ? 

Paulo