473,804 Members | 3,802 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 1672
On 2005-10-10, Tuvas <br***@yahoo.co m> 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
3376
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 a problem with the callbacks, for example: class X { public: add(); };
25
2676
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 platform API call? I was able to do this in Windows with a Windows.h function, but I want to also do it on Linux/Unix as well. I won't ask for a Linux API call that positions the cursor, as that is
19
2519
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 the declaration for the C library function (stdlib.h in this case) then define/declare my own function with the same name, am I safe? It seems to work on my compiler, but I wonder if this is portable or even acceptable? thx
50
3524
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 intertwined with the OS (string.h and other headers are there). So does this mean that when I program in C and use standard library functions, it's similar to calling the OS specific APIs (same type of performance)? Seeing all these Standard...
9
8301
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 make few other functions reentrant on Linux platform? I have searched a lot on the web for it but without any success. Man page of signal(2) has listed system calls (POSIX 1003.1-2003 list) which are safe(reentrant) but thats not sufficient for...
4
2137
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) and the Language Objects Library) that I have converted over to C#. It works okay. However, in the C# version, one has to build the class library into the generated application, because I haven't structured this one thing right. I would like to...
72
4458
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: http://msdn.microsoft.com/msdnmag/issues/05/05/SafeCandC/default.aspx jacob
20
3544
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 part of the Unix thought process, but is Mnot essential for a working OS. There are no Standard C Library functions for process forking or overlaying. The fork() and execve() functions are part of the C language bindings to POSIX. They are not...
2
2256
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 program stack, manages heap??? and how can i find out that does my compiler (or linker) produces dynamically linked runtime libraries (if so how can i make it to do it statically on gnu g++ on fedora c8)
16
3291
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
9706
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9577
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10325
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10315
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
6847
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5519
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5651
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3815
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2990
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.