关于使用Julia包装C代码的调试技巧

时间:2016-01-22 10:02:05

标签: c wrapper julia

C结构:

console.log("C:\fakepath\extra\random.html".match(/([^\\]*$)/));

我写的Julia数据类型:

typedef struct {
    int32_t tid;
    int32_t pos;
    uint32_t bin:16, qual:8, l_qname:8;
    uint32_t flag:16, n_cigar:16;
    int32_t l_qseq;
    int32_t mtid;
    int32_t mpos;
    int32_t isize;
} bam1_core_t;

typedef struct {
    bam1_core_t core;
    int l_data, m_data;
    uint8_t *data;
    uint64_t id;
} bam1_t;

当我在julia函数中使用上面的数据类型type BinQualLqname bin::UInt16 qual::UInt8 l_qname::UInt8 end type FlagNCigar flag::UInt16 n_cigar::UInt16 end type Bam1_core_t tid::Int32 pos::Int32 bin_qual_lqname::BinQualLqname flag_ncigar::FlagNCigar l_qseq::Int32 mtid::Int32 mpos::Int32 isize::Int32 end type Bam1_t core::Ptr{Bam1_core_t} l_data::Int32 m_data::Int32 data::Ptr{Cuchar} id::UInt64 end 时:

Bam1_t

function sam_read1!(samfile,bamheader,b::Ptr{Bam1_t}) record = ccall((:sam_read1,"libhts"),Cint, (Ptr{Void},Ptr{Void},Ptr{Bam1_t}),samfile,bamheader,b) end 修改的b中的数据是无意义的。我该怎么调试呢?是否有推荐的工具或提示?

1 个答案:

答案 0 :(得分:2)

sam_read1

int sam_read1(tamFile fp, bam_header_t *header, bam1_t *b);  

,其中

typedef struct { 
    bam1_core_t core; 
    int l_aux, data_len, m_data; 
    uint8_t *data; 
} bam1_t;  

似乎与您的Bam1_t不同。将

type Bam1_t
    core::Bam1_core_t
    l_aux::Int32
    data_len::Int32
    m_data::Int32
    data::Ptr{Cuchar}
end

工作?