Automate conversion process for existing libraries

109 views
Skip to first unread message

Adam Smith

unread,
Aug 10, 2012, 12:37:43 PM8/10/12
to bi...@googlegroups.com
Hey, thanks for bitey! It seems likely to open up a whole new category of python integration projects and is very exciting.

I'm curious if you have advice on how one could start trying to automate conversion of existing c/gcc projects to be llvm bitcode and bitey compatibile. There seem to be a few things that need to be done to have an existing c library be bitey-accessible (did I miss anything?):
  • Process the c files to automatically build pre-load files with the struct member names filled in.
  • Process the c files to automatically build pre-load files with automatically loaded dependencies.
  • Convert the makefile to invoke clang to produce bitcode instead of gcc object code.
On an aside, I think the closest project to bitey might be Adobe Alchemy. I wonder if they have useful tools for project conversion that bitey could piggy-back off of.

David Beazley

unread,
Aug 10, 2012, 12:50:00 PM8/10/12
to bi...@googlegroups.com, David Beazley
Adam,

To be honest, I think Bitey might be in some uncharted territory with some of the things you're asking about. Even for myself, the build environment is a completely new kind of thing.

I think the most important thing is that my vision for Bitey is not as a replacement for a wrapper tool like Swig. Instead, I see it as something that might have interesting uses for writing smallish extensions to Python, making it easy to pass them around, and do interesting things with them. It might, in theory, be possible to take a large existing library and compile it down to something that Bitey could handle. At a minimum, you would have to compile and link all of the source code as LLVM bitcode though.

The use of pre and post-load files is also somewhat unexplored. Whether or not they're automatically generated, they could certainly be something that someone could use to patch a few things up here and there in the import process.

I would actually love to hear about anyone trying to use Bitey with a larger code base. I've got some experiments in progress with some of my old C code, but still need to mess around with it more.

Cheers,
Dave
> --
> You received this message because you are subscribed to the Google Groups "bitey" group.
> To unsubscribe from this group, send email to bitey+un...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>

Adam Smith

unread,
Aug 10, 2012, 1:25:43 PM8/10/12
to bi...@googlegroups.com, David Beazley
I looked more into alchemy, but they used a slightly different approach by modifying gcc itself to generate as3 source and use llvm to make as3 bytecode. I don't think their tools could be used for bitey.

I'm pretty excited about bitey being useful in web app worker daemons (behind task queues) for optimizing performance-critical stuff. I just never liked the way cython mixes c and python and how careful you have to be to make sure the right types get optimized. Being able to write c unmodified and call it trivially from python will make moving performance-critical code over much easier.

Adam Smith

unread,
Nov 3, 2012, 8:13:53 PM11/3/12
to bi...@googlegroups.com, David Beazley
I finally got around to starting a project with bitey, and I still really wanted to automate struct member names. I put together a gist that patches bitey to run exuberant ctags on files and generates .pre.py files automatically:


It would be better to not blow away the .pre.py files and instead make a .pre.struct.py that is included in the .pre.py or something, but it's a good start and it seems to work well so far.

 a d a m
Reply all
Reply to author
Forward
0 new messages