VanL / shedskin

Shed Skin is an experimental compiler, that can translate pure, but implicitly statically typed Python (2.4-2.6) programs into optimized C++
0 stars 1 forks source link

Cannot import OpenGL or SFML modules #166

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Is there ever going to be any progress on allowing arbitrary Python modules to 
be imported with shedskin? 

For example Im trying to import OpenGL and PySFML, and it still just gives 
"cannot locate module" 

Shedskin is great in principle, but its pretty useless if we cant import 
commonly used modules.

Perhaps the documentation could explain how the community could create & submit 
the bindings to shedskin.

Original issue reported on code.google.com by mkr3...@gmail.com on 15 Apr 2012 at 9:26

GoogleCodeExporter commented 9 years ago
Btw I would love to help in getting the bindings working for these modules, as 
long as Mark states officially what the correct & easy way to do it is.

Original comment by mkr3...@gmail.com on 15 Apr 2012 at 9:40

GoogleCodeExporter commented 9 years ago
unfortunately global type inference will never work with arbitrary libraries, 
without some or a lot of manual work for each library.. and sometimes even that 
isn't possible, because a library is too large or dynamic.

it is often possible though, and this is the preferred method of integration, 
to have shedskin generate an extension module for some performance critical 
piece of code, and import this into a larger program. see the shedskin example 
programs for many examples of this.. (some of these use pygtk, pygame or 
multiprocessing in this way).

so extension modules really are the preferred way to deal with non-standard 
libraries. but if you insist, the correct way to add bindings is to add a .py 
model to the lib/ dir, enough for shedskin to perform type inference, and 
manual  .?pp files that call into the library you want to bind. this is 
actually described in the documentation ("Calling C/C++ Code"), and there are 
lots of examples in lib/ already. just have a look there :-)

Original comment by mark.duf...@gmail.com on 16 Apr 2012 at 2:33