On Saturday,  3 May 2003 at  6:49:12 +0900, Lyle Johnson wrote:
> Jim Freeze wrote:
> 
> > I can't seem to get swig to work when my function
> > has a pointer argument. Here is my simple example:
> > 
> Modify your SWIG interface file to look like this:
> 
>      /* example.i */
>      %module example
> 
>      %include typemaps.i
> 
>      extern int fact2(int *INPUT);
> 
> Re-run SWIG, re-compile, etc. and it should work as expected.
> 
> Now, for the "why" part. SWIG is no Kreskin, and it can't guess from 
> this declaration:
> 
>      extern int fact2(int *n);
> 

[description snipped]

Thanks Lyle for the fine description. I had %include typemaps.i
and I was just about to go find your presentation at rubyconf.

So, the instant gratification worked... but I was not giving
you the whole story. The real function was:

  fact2(int *INPUT, char **str);


After reading your email, I changed this to:

  fact2(int *INPUT, char **INPUT);

But compiling and running gives me the error:

  test.rb:3:in `fact2': Expected char ** (TypeError)
        from test.rb:3

So, I changed the header description in the .i file (without
changing the actual function definition) to:

  fact2(int *INPUT, char *INPUT);

Now, it appears to be getting past the initial function 
parameter passing, but I get the error:

  ruby test.rb
  ld.so.1: /tools/apps/ruby/ruby-1.8.0/bin/ruby: fatal: relocation error:
  file ./example.so: symbol fact2: referenced symbol not found
  Killed


I've seen this error before, but googling did not give me an answer.


-- 
Jim Freeze
----------
Be braver -- you can't cross a chasm in two small jumps.