ctypes listing dll functions

M

marc.wyburn

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.
 
T

Tim Roberts

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,479
Members
44,899
Latest member
RodneyMcAu

Latest Threads

Top