Thanks for all replies. Will look into ciffi.

On Tue, Nov 10, 2015 at 8:57 AM, <jcup...@gmail.com> wrote:

> On 10 November 2015 at 00:52, Bartosz Debski <bart...@debski.co.uk> wrote:
> > I know this is not directly pygame related question but I'm looking for
> help
> > from more c++/Python able.
> >
> > I'm trying to get some use of Steam libraries which are C++. I have
> managed
> > quite easily to load Steam library and initialize it with use of Python
> > ctypes (Steam lib returns loaded Steam App)
> >
> > Now as I'm trying to get more useful information from documentation, all
> is
> > in C++ and all references are C++.
> >
> > eg:
> > "
> > At the beginning of a game session, call
> > SteamUserStats()->RequestCurrentStats() to fetch the user's data from the
> > Steam back end. You will receive a UserStatsReceived_t callback when the
> > data is ready.
>
> In that C++, SteamUserStats() is returning a struct, and that struct
> contains a function pointer called RequestCurrentStats() which you
> must then call. The function pointer might be a plain struct member,
> or it might be a class member, perhaps on the vfunc table. you'd need
> to do some digging to find out exactly how it all works. It would be
> rather difficult in ctypes.
>
> Have you looked at cffi? It's a modern replacement for ctypes which
> automates a lot of this stuff. You just give it a copy of the C++
> headers and it generates all of the glue code for you. There's a nice
> post here:
>
> http://eli.thegreenplace.net/2013/03/09/python-ffi-with-ctypes-and-cffi
>
> And some demos and examples in the cffi project:
>
> https://bitbucket.org/cffi/cffi/src/default/demo/
>
> John
>

Reply via email to