Re: passing string argument to external C function

From: Fred Clare <fred_at_nyahnyahspammersnyahnyah>
Date: Thu, 1 Feb 2007 15:03:23 -0700

James,

Attached is a simple example of C source that
can be used to create a shared object that provides
an NCL function that prints an NCL string.

Using this in NCL I get:

ncl 0> external PSTRING "str_example.so"
ncl 1> PSTRING::print_string("This is an NCL string")
 From print_string: This is an NCL string

If this does not help, let me know.

As for what a Quark is, don't ask. :-)

Fred Clare

On Jan 30, 2007, at 7:02 PM, James McPhee wrote:

> Dear All,
>
> I'm trying to implement a ncl-callable external C routine that
> unpacks binary data. I have been able to compile and link the
> original C source code (obtained from third party) and the C
> wrapper code (mine) into a shared object that then I try to load
> using the "external" command in ncl.
>
> The idea is to pass the filename (a string) of the dataset to the
> external function from NCL. However, when I try to do this the
> unpacking routine complains. It seems that the value of the string
> is being lost somewhere, possibly during the call to NclGetArgValue
> in the wrapper routine. I've been playing around A LOT with this
> and can't find the source of the error. I tried reproducing some of
> the examples found in the NCL website (cquad, arcln) but those only
> illustrate the case of double arguments. Disclaimer: I'm not much
> of a C programmer :-(
>
> I'm attaching my source files and a sample dataset. I'll be
> grateful if someone could provide advice...
>
> James
>
> <unpacker.tar.gz>
>
> James McPhee
> Profesor Asistente, Departamento de Ingenieria Civil
> Facultad de Ciencias Fisicas y Matematicas, Universidad de Chile
> Av. Blanco Encalada 2002 piso 3
> Santiago, Chile
> tel: +56-2-9784400
> jmcphee_at_ing.uchile.cl
> http://www.cec.uchile.cl/~jmcphee
>
>
>
> _______________________________________________
> ncl-talk mailing list
> ncl-talk_at_ucar.edu
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk

_______________________________________________
ncl-talk mailing list
ncl-talk_at_ucar.edu
http://mailman.ucar.edu/mailman/listinfo/ncl-talk

Received on Thu Feb 01 2007 - 15:03:23 MST

This archive was generated by hypermail 2.2.0 : Mon Feb 05 2007 - 10:20:04 MST