I need two instances of the same function (not just alias). One thing that definitely works is
void writedata(union chip *tempchip, unsigned char *datapos, int datanum)
{
blahblah
}
void writestring(union chip *tempchip, unsigned char *datapos, int datanum)
{
writedata(tempchip, datapos, datanum);
}
This is kind of silly, because the second just passes parameters to the first. So I tried to be "smart" and make a pointer
void writedata(union chip *tempchip, unsigned char *datapos, int datanum)
{
blahblah
}
void (* writestring)(union chip *, unsigned char *, int) = writedata;
which on using returns segmentation error. Why is the second method not working?
EDIT: I am calling both functions from Python
via ctypes
:
writedata = parallel.writedata
writedata.argtypes = [devpointer, POINTER(c_ubyte), c_int]
writestring = parallel.writestring
writestring.argtypes = [devpointer, c_char_p, c_int]
because I want to supply both string
s and byte array
s as the second argument.