Dear bliako, dear Dave, Thank you very much for your hints. I traced to my test script and - to be honest - I don't understand very much :-) But, I think Dave is right. The callp function is hited two times, the first time by perl, and the second time by a mpv/mpv core thread. The passed args are the same, so that I think, that the assignment from incompatible pointer type warnings are at the moment less important.. I will read the perlembed manual, but it is really a steep learning curve, hopefully not too steep... PS.: Here the output of gdb:
(gdb) run Starting program: /usr/bin/perl ./play2.t [Thread debugging using libthread_db enabled] Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so +.1". [New Thread 0x7fffc9dca700 (LWP 7239)] callback called Thread 2 "mpv/mpv core" received signal SIGSEGV, Segmentation fault. [Switching to Thread 0x7fffc9dca700 (LWP 7239)] 0x00007ffff6ab126d in callp (string=0x5555559756b0) at Simple.xs:30 30 dMY_CXT; (gdb) break Simple.xs:27 Haltepunkt 1 at 0x7ffff6ab1255: file Simple.xs, line 27. (gdb) run The program being debugged has been started already. Start it from the beginning? (y or n) x Please answer y or n. The program being debugged has been started already. Start it from the beginning? (y or n) y Starting program: /usr/bin/perl ./play2.t [Thread debugging using libthread_db enabled] Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so +.1". [New Thread 0x7fffc9dca700 (LWP 7241)] Thread 1 "perl" hit Breakpoint 1, callp (string=0x5555559756b0) at Sim +ple.xs:29 29 dTHX; (gdb) s __GI___pthread_getspecific (key=0) at pthread_getspecific.c:30 30 pthread_getspecific.c: Datei oder Verzeichnis nicht gefunden. (gdb) s 31 in pthread_getspecific.c (gdb) s 55 in pthread_getspecific.c (gdb) s 56 in pthread_getspecific.c (gdb) s 60 in pthread_getspecific.c (gdb) s 65 in pthread_getspecific.c (gdb) s callp (string=0x5555559756b0) at Simple.xs:30 30 dMY_CXT; (gdb) s 31 dSP; (gdb) s 33 ENTER; SAVETMPS; (gdb) s 34 PUSHMARK(SP); (gdb) s 36 PUTBACK; (gdb) s 38 perl_call_sv(MY_CXT.callback,G_DISCARD|G_NOARGS); (gdb) s callback called 39 SPAGAIN; (gdb) s 41 PUTBACK;FREETMPS;LEAVE; (gdb) s 43 } (gdb) s 0x00007ffff67708aa in mpv_set_wakeup_callback () from /usr/lib/x86_64- +linux-gnu/libmpv.so.1 (gdb) s Single stepping until exit from function mpv_set_wakeup_callback, which has no line number information. __GI___pthread_mutex_unlock (mutex=0x7fffc4018a08) at pthread_mutex_un +lock.c:345 345 pthread_mutex_unlock.c: Datei oder Verzeichnis nicht gefunden. (gdb) s __pthread_mutex_unlock_usercnt (decr=1, mutex=0x7fffc4018a08) at pthre +ad_mutex_unlock.c:344 344 in pthread_mutex_unlock.c (gdb) s 345 in pthread_mutex_unlock.c (gdb) s __pthread_mutex_unlock_usercnt (decr=1, mutex=0x7fffc4018a08) at pthre +ad_mutex_unlock.c:38 38 in pthread_mutex_unlock.c (gdb) s 39 in pthread_mutex_unlock.c (gdb) s 38 in pthread_mutex_unlock.c (gdb) s 39 in pthread_mutex_unlock.c (gdb) s 43 in pthread_mutex_unlock.c (gdb) s 48 in pthread_mutex_unlock.c (gdb) s 51 in pthread_mutex_unlock.c (gdb) s 54 in pthread_mutex_unlock.c (gdb) s 56 in pthread_mutex_unlock.c (gdb) s __GI___pthread_mutex_unlock (mutex=0x7fffc4018a08) at pthread_mutex_un +lock.c:346 346 in pthread_mutex_unlock.c (gdb) s XS_MPV__Simple__xs_set_wakeup_callback (my_perl=0x555555953260, cv=0x5 +55555aae830) at Simple.c:524 524 XSRETURN_EMPTY; (gdb) s 525 } (gdb) s 0x0000555555630201 in Perl_pp_entersub () (gdb) s Single stepping until exit from function Perl_pp_entersub, which has no line number information. 0x0000555555628026 in Perl_runops_standard () (gdb) s Single stepping until exit from function Perl_runops_standard, which has no line number information. [Switching to Thread 0x7fffc9dca700 (LWP 7241)] Thread 2 "mpv/mpv core" hit Breakpoint 1, callp (string=0x5555559756b0 +) at Simple.xs:29 29 dTHX; (gdb) s __GI___pthread_getspecific (key=0) at pthread_getspecific.c:30 30 pthread_getspecific.c: Datei oder Verzeichnis nicht gefunden. (gdb) s 31 in pthread_getspecific.c (gdb) s 55 in pthread_getspecific.c (gdb) s 56 in pthread_getspecific.c (gdb) s 65 in pthread_getspecific.c (gdb) s callp (string=0x5555559756b0) at Simple.xs:30 30 dMY_CXT; (gdb) s Thread 2 "mpv/mpv core" received signal SIGSEGV, Segmentation fault. 0x00007ffff6ab126d in callp (string=0x5555559756b0) at Simple.xs:30 30 dMY_CXT;

In reply to Re: XS callback to mpv_set_wakeup_callback by MaxPerl
in thread XS callback to mpv_set_wakeup_callback by MaxPerl

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.