in reply to Re: Wrapping a C library
in thread Wrapping a C library

I had no idea you were going to do this so I'm sorry for a late response. I can get you a data source here: Level3 or Level2

I see you used the library installed on linux. I would like to use this library under windows, can inline::c use just the C files? Is there a way I can do this in windows?

Replies are listed 'Best First'.
Re^3: Wrapping a C library
by syphilis (Archbishop) on Mar 24, 2009 at 08:58 UTC
    I would like to use this library under windows

    If you have the library on windows, then you can use it with Inline::C in the same way as ig used it on linux. Is there a Windows version of this library available ? The source wouldn't compile for me (on Windows) due to (at least) one missing header file - and I didn't persevere with trying to find a workaround.

    can inline::c use just the C files?

    You could probably use just the C files with Inline::C - but you'd still need to overcome that problem of the missing header(s), and it's much simpler, imo, to use the library anyway.

    Cheers,
    Rob
Re^3: Wrapping a C library on Windows
by ig (Vicar) on Mar 24, 2009 at 10:01 UTC

    This can be done on Windows, but I don't have a Windows build environment myself. I'm sure others here can tell you what you will need to support Inline::C or XS (the former is just an interface to the latter) on Windows.

Re^3: Wrapping a C library
by ig (Vicar) on Mar 24, 2009 at 23:16 UTC

    The following slightly modified script produces a set of gif files given a data file and a site ID as arguments. So, not surprisingly, the library can be called from Perl on Linux platform quite easily.

    Regarding using the library on Windows, note the following from the GVBOX page - http://trmm-fc.gsfc.nasa.gov/trmm_gv/software/gvbox/gvbox.html:

    It is assumed that you have a working Unix operating system and that you can compile C, C++ and Fortran source code, and that you have perl and optionally bison and flex.

    I can't find any evidence that it has been ported to Windows - which doesn't mean that it hasn't been or that it would be difficult to do.

    #!/usr/bin/perl # use Inline C => DATA => INC => '-I/usr/local/trmm/GVBOX/include' => LIBS => '-L/usr/local/trmm/GVBOX/lib -lrsl'; my $file = shift or die "USAGE: radar.pl file ID\n"; my $id = shift or die "USAGE: radar.pl file ID\n"; my_test($file, $id); __END__ __C__ #include "rsl.h" int my_test(char* file, char* id) { Radar *radar; radar = RSL_anyformat_to_radar(file, id); RSL_load_refl_color_table(); RSL_volume_to_gif(radar->v[DZ_INDEX], "dz_sweep", 400, 400, 200.0) +; return(0); }
      Thanks for all your work!! What I would really like to do is have this in a perl module named RSL. What would be the best way to do that?