in reply to Wrapping a C library

As a tease for Inline::C, the following is from the start of the library's documentation. It gets as far as telling me the library doesn't recognize the file type. In a quick search I couldn't find a compatible data file for download.

#!/usr/bin/perl # use Inline C => DATA => INC => '-I/usr/local/trmm/GVBOX/include' => LIBS => '-L/usr/local/trmm/GVBOX/lib -lrsl'; my_test(); __END__ __C__ #include "rsl.h" int my_test() { Radar *radar; radar = RSL_anyformat_to_radar("radar.dat", NULL); RSL_load_refl_color_table(); RSL_volume_to_gif(radar->v[DZ_INDEX], "dz_sweep", 400, 400, 200.0) +; return(0); }

If someone posts a link to a compatible data file I would poke at it some more.

Replies are listed 'Best First'.
Re^2: Wrapping a C library
by deadpickle (Pilgrim) on Mar 24, 2009 at 06:20 UTC
    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?

      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

      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.

      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?