* syntax for pointer to pointer to function?
@ 1998-04-13 9:38 Michael Poole
1998-06-28 2:05 ` Jeffrey A Law
0 siblings, 1 reply; 2+ messages in thread
From: Michael Poole @ 1998-04-13 9:38 UTC (permalink / raw)
To: egcs
What is the proper syntax for declaring a pointer to a pointer to a
function with certain attributes? The latest Wine snapshot (980413) has
code that is very similar to the test case below, which some people have
reported to work, but which does not compile under egcs-1.0.2, generating
this error:
test.c: In function `test_wrapper':
test.c:10: warning: `__stdcall__' attribute directive ignored
test.c:10: `type name' declared as function returning a function
test.c:10: cast specifies function type
The code compiles and runs correctly without CALLBACK being present,
so that appears to be the real difference; is this an error in the code,
or an error in the parser? If it is an error in the code, what is the
correct syntax?
-- Test case --
#include <stdio.h>
#define CALLBACK __attribute__((__stdcall__))
void CALLBACK test_func(int i) {
printf("test_func(%d)\n", i);
}
void test_wrapper(void *fn_ptr_ptr) {
*(void (CALLBACK **)(int))fn_ptr_ptr = test_func;
}
int main(int argc, int argv) {
void (CALLBACK *my_fn)(int);
test_wrapper(&my_fn);
my_fn(argc);
}
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: syntax for pointer to pointer to function?
1998-04-13 9:38 syntax for pointer to pointer to function? Michael Poole
@ 1998-06-28 2:05 ` Jeffrey A Law
0 siblings, 0 replies; 2+ messages in thread
From: Jeffrey A Law @ 1998-06-28 2:05 UTC (permalink / raw)
To: Michael Poole; +Cc: egcs
In message <m3d8el8yng.fsf@graviton.res.cmu.edu>you write:
> What is the proper syntax for declaring a pointer to a pointer to a
> function with certain attributes? The latest Wine snapshot (980413) has
> code that is very similar to the test case below, which some people have
> reported to work, but which does not compile under egcs-1.0.2, generating
> this error:
I don't think you can do this. Basically I think all our attribute
stuff falls down when you try to take a pointer to an object that has
an attribute.
jeff
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~1998-06-28 2:05 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1998-04-13 9:38 syntax for pointer to pointer to function? Michael Poole
1998-06-28 2:05 ` Jeffrey A Law
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).