Lazarus

Programming => Packages and Libraries => Topic started by: BigChimp on October 19, 2012, 12:21:54 pm

Title: SWIG C++ binding generator: found Delphi unit. Extend to FPC?
Post by: BigChimp on October 19, 2012, 12:21:54 pm
I've mentioned that Stefano Moratti created a Delphi module for SWIG, which generates object-oriented bindings out of C++ code:
http://stackoverflow.com/questions/2559995/create-an-instance-of-an-exported-c-class-from-delphi (http://stackoverflow.com/questions/2559995/create-an-instance-of-an-exported-c-class-from-delphi)
Quote
I've written a SWIG module targetting ObjectPascal and I'm using it successfully in my own project. I've traslated GEOS, and GDAL/OGR library. I also have a branch in the SWIG repository, BUT I still have to complete the final steps to build all the test suites and to fixup the typemaps in order to have the module be accepted.

Someone would like to help?

I finally found a patch dating back to 2008:
https://sourceforge.net/tracker/?func=browse&group_id=1645&atid=301645 (https://sourceforge.net/tracker/?func=browse&group_id=1645&atid=301645)
... perhaps that's the one Stefano meant.

Perhaps adapting this to current SWIG+FreePascal could be worthwile so you can get object-oriented bindings for C++ code...

Thanks,
Reinier
Title: Re: SWIG C++ binding generator: found Delphi unit. Extend to FPC?
Post by: BigChimp on October 19, 2012, 12:28:35 pm
SWIG development mailing list discussion on the module:
http://thread.gmane.org/gmane.comp.programming.swig.devel/18297 (http://thread.gmane.org/gmane.comp.programming.swig.devel/18297)
Title: Re: SWIG C++ binding generator: found Delphi unit. Extend to FPC?
Post by: vfclists on November 26, 2012, 01:29:05 pm
This is interesting - anyway I found what seems to be the exact patches in this link.

http://sourceforge.net/tracker/?func=detail&aid=2010931&group_id=1645&atid=301645
Title: Re: SWIG C++ binding generator: found Delphi unit. Extend to FPC?
Post by: BigChimp on November 26, 2012, 01:43:01 pm
@vcflists. Yep, found that too.

Meanwhile, d.l.i.w. ported the patches to a newer swig version with good results; see this thread:
http://www.mail-archive.com/fpc-pascal@lists.freepascal.org/msg30422.html (http://www.mail-archive.com/fpc-pascal@lists.freepascal.org/msg30422.html)
Title: Re: SWIG C++ binding generator: found Delphi unit. Extend to FPC?
Post by: BigChimp on July 19, 2013, 12:19:27 pm
Created a wiki page to bundle all information:
http://wiki.lazarus.freepascal.org/SWIG
Title: Re: SWIG C++ binding generator: found Delphi unit. Extend to FPC?
Post by: srcstorm on April 16, 2017, 04:35:55 am
An updated version is published here:
http://www.fmxexpress.com/create-wrapper-interfaces-for-c-and-c-libraries-using-swig-with-delphi-support (http://www.fmxexpress.com/create-wrapper-interfaces-for-c-and-c-libraries-using-swig-with-delphi-support)

Title: Re: SWIG C++ binding generator: found Delphi unit. Extend to FPC?
Post by: avra on April 16, 2017, 01:42:32 pm
An updated version is published here
I don't believe my eyes  :) :D :)
Title: Re: SWIG C++ binding generator: found Delphi unit. Extend to FPC?
Post by: sarason on October 15, 2017, 01:21:33 am
I will have to say , what a great effort!
I tried to get SWIG operating a few years back but largely failed in my endeavours. It is good to see some success at a problem which I know from personal experience could not have been easy!

regards sarason