I am sorry, thats a typo. The reason I posted because I am getting a compiler error (C3374) . My question should be reformatted to : Can I pass pointer to member function of a Managed class to un-managed class without using delegates.
If I CANNOT then I will just use delegates instead.
No: this is not possible. There is really no such think as a pointer-to-member for a managed class (the internals of a managed class are completely managed by the CLR and hence you can't create such a thing). You'll have to use a delegate for this purpose.
Function pointer for GC
Philip Borchert
I do not think there is a concept of function pointers at the CLI language level.
Pinning pointers refer to class data (or the class itself), not methods of a class.
John J. Adams
You are almost there - the correct syntax is:
foo(d, &galvac_c::foo);
Hicham_IT
The reason I posted because I am getting a compiler error (C3374) . My question should be reformatted to : Can I pass pointer to member function of a Managed class to un-managed class without using delegates.
If I CANNOT then I will just use delegates instead.
Guillermo Leal-Collazo
Rockfan
Othmane Rahmouni-MSFT
Rj_murray
__gc struct galvac_c {
....
int **d;
static void foo(galvac_c *instance, int *a) {
....
}
};
void boo( galvac_c* inst, void (*foo)( galvac_c* ,int)) {
...
foo(inst,cur_num);
...
}
int _tmain {
galvac_c *d = new galvac_c();
foo(d,galvac_c::foo);
}
adrianol