
Untitled
By: a guest on
May 7th, 2012 | syntax:
None | size: 0.55 KB | hits: 13 | expires: Never
Problems with ctypes in Python 2.4.4 in Windows 7
#include <string.h>
struct config_info_t {
unsigned int count;
char string[64];
};
struct config_info_t conf;
__declspec(dllexport) int set_global_config(struct config_info_t * cfg)
{
conf.count = cfg->count;
strcpy(conf.string, cfg->string);
return 0;
}
from ctypes import *
Dll = WinDLL ("test.dll")
class CONFIG_INFO(Structure):
_fields_ = [("count", c_int),
("string", c_char * 64)]
cfg = CONFIG_INFO(10, "somesh")
result = Dll.set_global_config(byref(cfg))