473,387 Members | 1,619 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

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
3 1660
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: womanontheinside | last post by:
I have a library which was written in C, you call a function, it provides the result by a callback to specific function names. I am trying to wrap the calls to this inside a class, but this causes...
25
by: JeffS | last post by:
Honest, I scoured the comp.lang.c.faq for this but found nothing. :) Is there a library function for placing the cursor position in the console? Or is it something that can only be done with a...
19
by: Deniz Bahar | last post by:
Hi, I would like to call one of my functions the exact name as an existing C library function (for example K&R2 exercises asks me to make an atof function). If I don't include the header with...
50
by: Romeo Colacitti | last post by:
Is the C library of most OSes (i.e, unix type OSes) implemented at the very low kernel or just outside kernel level? Looking through the source tree of Linux/BSDs it seems like the C library is...
9
by: TheOne | last post by:
Would anyone please point me to a list of reentrant C library functions? I want to know which C library functions are safe to use inside a signal handler across all platforms. Does GNU C library...
4
by: Chris F Clark | last post by:
Please excuse the length of this post, I am unfortunately long-winded, and don't know how to make my postings more brief. I have a C++ class library (and application generator, called Yacc++(r)...
72
by: jacob navia | last post by:
We have discussed often the proposition from Microsoft for a safer C library. A rationale document is published here by one of the members of the design team at microsoft:...
20
by: J de Boyne Pollard | last post by:
MThe library functions which are included to allow process Mlaunch, forking, and termination, imply that it is both Mpossible and desirable for a process to fork itself. This is Ma fundamental...
2
by: mohi | last post by:
hello every one , this may be very basic question and may be a bit out of topic ,, can anyone please tell me what are the functions of runtime library and are they the one which create the...
16
by: Xiaoxiao | last post by:
Hi, I got a C library, is there a way to view the public function names in this library so that I can use in my C program? Thanks.
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.