Ticket #1992 (new bug) — at Version 2
[NCI] callback sub parameter definition isn't unified with callback definition in the C lib.
Reported by: | jimmy | Owned by: | |
---|---|---|---|
Priority: | normal | Milestone: | |
Component: | core | Version: | 3.0.0 |
Severity: | medium | Keywords: | |
Cc: | Language: | ||
Patch status: | Platform: |
Description (last modified by jimmy) (diff)
Hello,
see https://github.com/parrot/parrot/blob/master/src/nci_test.c#-115 , there are two define here.
typedef void (*cb_C1_func)(const char*, void*); PARROT_DYNEXT_EXPORT void nci_cb_C1(cb_C1_func, void*);
the callback is created by:
cb_wrapped = new_callback cb, user_data, "vtU"
which means it's first parameter is external_data, and the two is user_data. that is, the callback function should be defined as this one:
.sub _call_back .param string external_data .param pmc user_data print "user data: " print u print "\n" print "external data: " print s print "\n" .end
but actually in t/pmc/nci.t, it's defined as:
.sub _call_back .param pmc user_data .param string external_data print "user data: " print u print "\n" print "external data: " print s print "\n" .end
according to t/pmc/nci.t it seems that no matter user_data is the first parameter or two, the callback sub must be defined as:
.sub _call_back .param pmc user_data .param string external_data .end
then I took a look at PDD16, and it's said user_data should be defined in the second parameter:
.sub _call_back .param string external_data .param pmc user_data .end
which is right.
Change History
Note: See
TracTickets for help on using
tickets.