467,906 Members | 1,662 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

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

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_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 can't be used.

I have a header file that starts;

#ifndef __DIRAC__
#define __DIRAC__
// Prototypes

const char *DiracVersion(void);
void *DiracCreate(long lambda, long quality, long numChannels,
float sampleRate, long (*readFromChannelsCallback)(float **data, long
numFrames, void *userData));
void *DiracCreate(long lambda, long quality, long numChannels,
float sampleRate, long (*readFromChannelsCallback)(float *data, long
numFrames, void *userData));
long DiracSetProperty(long selector, long double value, void
*dirac);
long double DiracGetProperty(long selector, void *dirac);
void DiracReset(bool clear, void *dirac);
long DiracProcess(float **audioOut, long numFrames, void *userData,
void *dirac);
long DiracProcess(float *audioOut, long numFrames, void *userData,
void *dirac);
void DiracDestroy(void *dirac);
long DiracGetInputBufferSizeInFrames(void *dirac);

I would have thought that DiracCreate, DiracSetProperty 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
  • viewed: 8072
Share:
1 Reply
ma*********@googlemail.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_object) 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(void);
void *DiracCreate(long lambda, long quality, long numChannels,
float sampleRate, long (*readFromChannelsCallback)(float **data, long
numFrames, void *userData));
void *DiracCreate(long lambda, long quality, long numChannels,
float sampleRate, long (*readFromChannelsCallback)(float *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 discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

6 posts views Thread by Ian Sparks | last post: by
1 post views Thread by Thomas Heller | last post: by
19 posts views Thread by Thomas Heller | last post: by
reply views Thread by marc.wyburn | last post: by
1 post views Thread by Massi | last post: by
6 posts views Thread by =?Utf-8?B?LnBhdWwu?= | last post: by
reply views Thread by gianluca | last post: by
2 posts views Thread by Jean-Paul Calderone | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.