Hi,
> Perhaps this could help somebody...
I kept an eye on Swig for quite some time, but reading your posting I
decided to give it a try.

A summary for everyone interested:
[latest swig (2.0.8) - adapted patch - not sure if I made everything
correct (API changed since the patch was made)]

1. The generated C++-Wrapper looks quite good and is compilable; at
some places it seems to be a bit overkill, e.g.:

<<--

SWIGEXPORT int Delphi_gcd(int pasarg0, int pasarg1) {
  int cresult = 0 ;
  int arg1 ;
  int arg2 ;
  int result;

  arg1 = (int)pasarg0;
  arg2 = (int)pasarg1;
  result = (int)gcd(arg1,arg2);
  cresult = result;
  return cresult;
}

-->>

Maybe I'm totally wrong, but in my eyes the following would be enough:

<<--
SWIGEXPORT int Delphi_gcd(int pasarg0, int pasarg1) {
  return (int)gcd((int)pasarg0,(int)pasarg1);
}
-->>

2. The Delphi / ObjectPascal part definitely needs some more work, the
function import is ok, but the object wrapper doesn't work properly
and swig generates unusable code [it could be, that I messed up
something, when adapting to new swig].

But if you would edit the pascal unit anyway - I certainly would - it
is quite usable in its current (early?) state...

I tested just out of interest and have no plans to do further work -
but I assume - if somebody really needs it - you could make it fully
work with little effort...

Hopefully this report helps somebody...
Btw. if somebody wants the adapted code, I will upload it..

Regards,
d.l.i.w
_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Reply via email to