# New Ticket Created by Itsuki Toyota
# Please include the string: [perl #129820]
# in the subject line of all future correspondence about this issue.
# <URL: https://rt.perl.org/Ticket/Display.html?id=129820 >
In the following example, ` my &ook = sub (Int $piyo) ` has wrong signature (`
my &ook = sub (Int $piyo, Num $fuga) ` is a right one)and it returns the error
message of "Internal error: Unwound entire stack and missed handler".
Honestly to say, it doesn't seem to make sense to me and I can't imagine what
to do.
* codes *
t/02-callback.t
------------------------
use v6;
use Test;
use NativeCall;
use lib <lib t>;
use CompileTestLib;
compile_test_lib('02-callback');
my sub doit(&foo_t (int32, num64 --> int32)) is native("./02-callback") { * }
{
my &ook = sub (Int $piyo) {
return 0;
}
doit(&ook);
}
done-testing;
------------------------
t/02-callback.c
------------------------
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include "02-callback.h"
#ifdef _WIN32
#define DLLEXPORT __declspec(dllexport)
#else
#define DLLEXPORT extern
#endif
int doit(foo_t foo){ foo(10,3.1); }
------------------------
t/02-callback.h
------------------------
#if ! defined(HEADER_CALLBACK_H)
#define HEADER_CALLBACK_H
#ifdef __cplusplus
extern "C" {
#endif
typedef int (*foo_t)(
int piyo,
double fuga
);
#ifdef __cplusplus
} /* closing brace for extern "C" */
#endif
#endif /* HEADER_CALLBACK_H */
------------------------
* results *
------------------------
$ mi6 test -v t/02-callback.t
==> Set PERL6LIB=/home/itoyota/Programs/p6-Foo/lib
==> prove -e /home/itoyota/.rakudobrew/bin/../moar-nom/install/bin/perl6 -r -v
t/02-callback.t
t/02-callback.t .. Internal error: Unwound entire stack and missed handler
Dubious, test returned 1 (wstat 256, 0x100)
No subtests run
Test Summary Report
-------------------
t/02-callback.t (Wstat: 256 Tests: 0 Failed: 0)
Non-zero exit status: 1
Parse errors: No plan found in TAP output
Files=1, Tests=0, 0 wallclock secs ( 0.01 usr 0.01 sys + 0.45 cusr 0.06
csys = 0.53 CPU)
Result: FAIL
------------------------
$ perl6 --version
This is Rakudo version 2016.09-105-g4abc28c built on MoarVM version
2016.09-13-g34c375a
implementing Perl 6.c.