Re: Pros and Cons of using existing runtimes?
"Roger Binns" <[email protected]> Tue, 17 Aug 2004 11:59:21 -0700
| Newsgroups | gmane.comp.lang.prothon.user |
|---|---|
| Message-ID | <[email protected]> |
Mukhsein Johari wrote: > As a side note: For libs, you said yourself that the > interesting python libs are C extensions anyway - why > not simply do a 'swig' to prothon? Et voila, instant > libs! Why is this no longer a solution to your libs > problem? If you are referring to the SWIG program as at swig.org then it isn't as simple as that. Using Swig requires a .i file to define the interface. The simplest form just #includes the C/C++ headers, but that is VERY rare. In most cases the developer does have to write extra stuff (for example dealing with C having seperate parameters pointing to a string and its length for binary ones). In my .i files I also dealt with releasing and acquiring the GIL. In reality this would all require putting a Prothon backend on Swig, plus porting the .i files. But AFAIK the python libs shipped with CPython do not use Swig. They code against the interpretter C API. You also can't do without that layer since code somewhere has to deal with issues such as allocating objects and who owns memory. Roger