I assumed that by declaring a class/static procedure, it should match BeginThread signature, but apprently I am wrong. What's wrong with my syntax?
A
class method, and a
static method, are two different things.
A
class method still has an implicit
Self parameter, which points at a class type rather than an object instance. This is not compatible with
BeginThread().
A
static method does not have a
Self parameter at all. This is compatible with
BeginThread().
A
static method must also be a
class method, but a
class method does not have to be a
static method.
Try this:
class function FindInfFile(p: pointer): PtrInt; static;
m_workerID := BeginThread(@TMainForm.FindInfFile, Self);
BTW, I know that I can declare a top level bare procedure for this, but I am just curious why a class procedure won't do the work.
It should, once you add
static to its declaration.