467,075 Members | 900 Online
Bytes | Developer Community
Ask Question

Home New Posts Topics Members FAQ

Post your question to a community of 467,075 developers. It's quick & easy.

Library functions

I am writing a program that mimics a program written in C, but using
Python-supiorior techniques. The C program calles a library function,
non-open source, I only know that it sends it a command
LINUX_CAN_Open() as for a few others as well. Is there a way I can call
this function from Python without opening the code, as the library is
not open sourced (I know, a rarity with Linux libraries, but, well, it
appears not to be...)? Perhaps write a C function that acts as a
wrapper, is there a way to do it directly? Any help is much
appreciated! Thanks!

Oct 10 '05 #1
  • viewed: 1497
Share:
3 Replies
On 2005-10-10, Tuvas <br***@yahoo.com> wrote:
I am writing a program that mimics a program written in C, but using
Python-supiorior techniques. The C program calles a library function,
non-open source, I only know that it sends it a command
LINUX_CAN_Open() as for a few others as well.


I've successfully used the ctypes module to call Windows DLLs
(coincidentally it's to send/receive CAN messanges). According
to the ctypes docs, you can use it to call functions in Linux
libraries as well.

--
Grant Edwards grante Yow! Now I can join WEIGHT
at WATCHERS!
visi.com
Oct 10 '05 #2
How exactly do you do that? Just to get some kind of an idea, perhaps
you could share bits of code? Thanks!

Oct 11 '05 #3
Tuvas wrote:
How exactly do you do that? Just to get some kind of an idea, perhaps
you could share bits of code? Thanks!


Did you check out the ctypes web site before asking? See
http://starship.python.net/crew/theller/ctypes/ and at least read
through the helpful tutorial before asking questions which are almost
certainly covered there. For example, right there near the top of the
first screen in the tutorial is an example of opening a Linux .so file...

-Peter
Oct 11 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

4 posts views Thread by womanontheinside@yahoo.com | last post: by
19 posts views Thread by Deniz Bahar | last post: by
50 posts views Thread by Romeo Colacitti | last post: by
9 posts views Thread by TheOne | last post: by
4 posts views Thread by Chris F Clark | last post: by
72 posts views Thread by jacob navia | last post: by
20 posts views Thread by J de Boyne Pollard | last post: by
2 posts views Thread by mohi | last post: by
16 posts views Thread by Xiaoxiao | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.