相关疑难解决方法(0)

本地localtime()段错误

在尝试公开localtimePerl 6中的功能时,我似乎做错了什么:

use NativeCall;
my class TimeStruct is repr<CStruct> {
    has int32 $!tm_sec;
    has int32 $!tm_min;
    has int32 $!tm_hour;
    has int32 $!tm_mday;
    has int32 $!tm_mon;
    has int32 $!tm_year;
    has int32 $!tm_wday;
    has int32 $!tm_yday;
    has int32 $!tm_isdst;
    has Str   $!tm_zone;
    has long  $!tm_gmtoff;
}

sub localtime(uint32 $epoch --> TimeStruct) is native {*}
dd localtime(time);  # segfault
Run Code Online (Sandbox Code Playgroud)

跑下perl6-lldb-m,我得到:

Process 82758 stopped
* thread #1, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0x5ae5dda1)
    frame #0: 0x00007fffe852efb4 libsystem_c.dylib`_st_localsub …
Run Code Online (Sandbox Code Playgroud)

perl6 nativecall raku

10
推荐指数
1
解决办法
113
查看次数

标签 统计

nativecall ×1

perl6 ×1

raku ×1