[Twisted-Python] Re: Using compiled C Library with Twisted?

Christopher Armstrong radix at twistedmatrix.com
Thu Apr 1 11:39:14 MST 2004


This message is more appropriate for twisted-python at twistedmatrix.com, 
not twisted-web at twistedmatrix.com.

> -------- Original Message --------
> Subject: [Twisted-web] Using compiled C Library with Twisted?
> From: Jiannan Fu <jf at ypsilon.net>
> To: twisted-web at twistedmatrix.com
> 
> hi there,
> i got the following problem: I have a set of compiled C files, providing 
> a API for a special encryption / decrytion of messages to be exchanged 
> over the internet, well documented and with a lot of programming 
> examples of how to work with it and its functions (in this case the 
> examples are all in C). Now i want to use it with twisted together, to 
> have all the advantages of twisted (especially the reactor instead of 
> threading, deferred and so on), but the C API to do the last step before 
> messages are send out.
> 
> The C API should just play some kind of middleware between the tcp-ip 
> protokoll and the twisted server. Is it possible to extending twisted 
> with that library by "just import" them?
> 
> Any kind of advice / suggestions would help

You don't have to do anything special to get C libraries to work with 
Twisted; you'll have to create a Python-C binding for them, of course, 
and then you just import the binding and call the functions in it.

Just call out to these functions to decode and encode chunks of data 
when you receive or send it. From the info you provided, that's all the 
advice I can come up with.

-- 
  Twisted | Christopher Armstrong: International Man of Twistery
   Radix  |          Release Manager,  Twisted Project
---------+           http://radix.twistedmatrix.com/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 256 bytes
Desc: OpenPGP digital signature
URL: </pipermail/twisted-python/attachments/20040401/56c61de6/attachment.sig>


More information about the Twisted-Python mailing list