A newb programmer here
I have a project involving pedestrian simulation
I'm planning to use libpedsim.dll in python with Ctypes but so far I cannot make the functions working
Can anyone point out how to make use of this DLL?

This is the class documentation: http://pedsim.silmaril.org/documentation/libpedsim/latest/classPed_1_1Tscene.html
This is the link for the download: http://pedsim.silmaril.org/download/

I tried to call it this way but it said that the function is not found

from ctypes import *
pedsim = cdll.libpedsim
print pedsim
pedsim.TScene()

Here is my limited info ...

# using the module ctypes you can access DLLs written in C/C++
# ctypes converts between Python types and C types
# there are two ways to write DLLs:
# most common uses cdecl, import with cdll
# Win and VB may use stdcall, import with windll
# module ctypes is built into Python25 and higher
# look under ctypes in the Python manual

from ctypes import *

# as an example let's use msvcrt.dll
# this is the MS C library containing many standard C functions
# import the C function strchr() from msvcrt.dll
strchr = cdll.msvcrt.strchr

# declare the return type ...
# a 'pointer to a string' (which then converts to a Python string)
strchr.restype = c_char_p

# these are the argument types ...
# Python string converts to 'pointer to a string' --> c_char_p
# Python single char string converts to C char --> c_char
strchr.argtypes = [c_char_p, c_char]

# now call the function and show the result
print strchr('abcdefg', 'd')  # result --> defg

# some C functions are easier to access ...
printf = cdll.msvcrt.printf
printf("Hello, %s\n", "World!")
This article has been dead for over six months. Start a new discussion instead.