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

Home Posts Topics Members FAQ

ctypes listing dll functions

hi all and before I start I apologise if I have this completely muddled
up but here goes.

I'm trying to call functions from a dll file in a python script but I
can't work out what functions are available. I'm using ctypes. I've
tried using dir(ctypes_obje ct) but the resultant output looks like a
list of standard functions and not the ones I'm looking for.

Also how can I tell if the dll was written in C or C++ as I understand
C++ dlls can't be used.

I have a header file that starts;

#ifndef __DIRAC__
#define __DIRAC__
// Prototypes

const char *DiracVersion(v oid);
void *DiracCreate(lo ng lambda, long quality, long numChannels,
float sampleRate, long (*readFromChann elsCallback)(fl oat **data, long
numFrames, void *userData));
void *DiracCreate(lo ng lambda, long quality, long numChannels,
float sampleRate, long (*readFromChann elsCallback)(fl oat *data, long
numFrames, void *userData));
long DiracSetPropert y(long selector, long double value, void
*dirac);
long double DiracGetPropert y(long selector, void *dirac);
void DiracReset(bool clear, void *dirac);
long DiracProcess(fl oat **audioOut, long numFrames, void *userData,
void *dirac);
long DiracProcess(fl oat *audioOut, long numFrames, void *userData,
void *dirac);
void DiracDestroy(vo id *dirac);
long DiracGetInputBu fferSizeInFrame s(void *dirac);

I would have thought that DiracCreate, DiracSetPropert y etc were all
callable functions. As you may have guessed I'm don't do much work in
C...

Thanks, MW.

Sep 8 '06 #1
1 10347
ma*********@goo glemail.com wrote:
>
hi all and before I start I apologise if I have this completely muddled
up but here goes.

I'm trying to call functions from a dll file in a python script but I
can't work out what functions are available. I'm using ctypes. I've
tried using dir(ctypes_obje ct) but the resultant output looks like a
list of standard functions and not the ones I'm looking for.
As far as I know, there is no way with ctypes to enumerate the functions
exported by a DLL. If you have Visual C++, you can use link.exe to do
this:
link /dump /exports xxxxx.dll
>Also how can I tell if the dll was written in C or C++ as I understand
C++ dlls can't be used.
Well, DLLs that use C++ features cannot be used. If the exported names are
"decorated" , then they can't be used.
>I have a header file that starts;

#ifndef __DIRAC__
#define __DIRAC__

// Prototypes

const char *DiracVersion(v oid);
void *DiracCreate(lo ng lambda, long quality, long numChannels,
float sampleRate, long (*readFromChann elsCallback)(fl oat **data, long
numFrames, void *userData));
void *DiracCreate(lo ng lambda, long quality, long numChannels,
float sampleRate, long (*readFromChann elsCallback)(fl oat *data, long
numFrames, void *userData));
That's called "function overloading": two functions with the same name but
slightly different parameters. That is only available with C++, so I'm
afraid you are out of luck. You may be able to use SWIG to generate an
interface for this; I've had good luck with SWIG.
--
- Tim Roberts, ti**@probo.com
Providenza & Boekelheide, Inc.
Sep 9 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
1920
by: Ian Sparks | last post by:
I have a python file with a number of functions named with the form doX so : doTask1 doThing doOther The order these are executed in is important and I want them to be executed top-down. They all have the same parameter signature so I'd like to do : for name, func in vars(mymodule).items(): if not name.startswith("do") and callable(func):
1
2592
by: Thomas Heller | last post by:
ctypes 0.9.1 released - Sept 14, 2004 ===================================== Overview ctypes is a ffi (Foreign Function Interface) package for Python 2.3 and higher. ctypes allows to call functions exposed from dlls/shared libraries and has extensive facilities to create, access and manipulate
19
2508
by: Thomas Heller | last post by:
ctypes 0.9.2 released - Oct 28, 2004 ==================================== Overview ctypes is a ffi (Foreign Function Interface) package for Python 2.3 and higher. ctypes allows to call functions exposed from dlls/shared libraries and has extensive facilities to create, access and manipulate
0
280
by: marc.wyburn | last post by:
hi all and before I start I apologise if I have this completely muddled up but here goes. I'm trying to call functions from a dll file in a python script but I can't work out what functions are available. I'm using ctypes. I've tried using dir(ctypes_object) but the resultant output looks like a list of standard functions and not the ones I'm looking for. Also how can I tell if the dll was written in C or C++ as I understand C++ dlls...
1
1991
by: Massi | last post by:
Hi everyone, I have a program which is written in C and interfaced with python via Ctypes. The functions I call print stuff out to the console, using the usual function printf. I would like to know if it is possible to redirect the output of my C module to python. I'm working on windows environment. Thanks in advance.
6
2565
by: =?Utf-8?B?LnBhdWwu?= | last post by:
how do i list all available functions in an unmanaged .dll? i tried using reflection, but that seems to only work with managed assemblies
9
7352
by: Matt | last post by:
Hi friends, Okay so well, I have quite a problem right now with a file stream. What I am doing is to use the Cannon SDK dlls to get control over my old Cannon A60 Camera for some surveillance useage. By using ctypes it all worked well until now. I am able to load the dlls, use a lot of functions, am able to connect to the camera, read out some params, send commands etc... but now I am stuck with reading the picture data.
0
1140
by: gianluca | last post by:
I've a problem with dll function colled with python/ctypes. My functions (C) requred a typedef int "value_type" in tree different way: same as value_type; - mydll.foo1(value_type) same as *value_type; - mydll.foo2(*value_type) same as **value_type; - mydll.foo3(**value_type) How can pass it in python. If i do that: rules=POINTER(value_type) opr=rsl.StrengthOfRules(rules,10)
2
16549
by: Jean-Paul Calderone | last post by:
On Mon, 30 Jun 2008 09:13:42 -0700 (PDT), gianluca <geonomica@gmail.comwrote: POINTER takes a class and returns a new class which represents a pointer to input class. pointer takes an instance and returns a new object which represents a pointer to that instance. Jean-Paul
0
9579
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,...
1
10317
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
10075
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9143
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6851
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
5520
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...
1
4295
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
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.