libgit2 - How to use libgit's git_repository_open in d -


i trying use libgit2 library in d. segmentation fault upon the program's exit. error not happen before exit, when open , close repository. seem issue garbage collector, manually disabling garbage collector (gc.disable();) seems not effect outcome @ all. freeing (git_repository_free(repo)) seems have no effect.

this example code:

import std.stdio : writeln; import std.string : tostringz;  import core.memory : gc;  import deimos.git2.types : git_repository; import deimos.git2.repository : git_repository_open, git_repository_free;  void main() {     gc.disable();     git_repository *repo;     git_repository_open(&repo, ".".tostringz());     git_repository_free(repo);     writeln("end"); } 

output:

$ ./gittest end zsh: segmentation fault (core dumped)  ./gittest 

the versions:

  • libgit2-dev: 0.22.1-0ubuntu3
  • libgit2: ~>0.20.1
  • dub: 0.9.23-0
  • dmd-bin: 2.067.1-0
  • kubuntu: 15.04

what, if anything, doing wrong? , if nothing can culprit of bug identified (d, libgit2, or libgit2 d bindings)?

additional note: tried working dlibgit , found incredibly buggy, being outdated seem. question refers libgit2 d bindings.

promoted comment:

libgit2 0.22.1 requires call git_libgit2_init before other libgit2 functions called. d bindings 0.20.1, don't provide binding function.

you can hack in bindings init/shutdown functions with:

extern (c): int git_libgit2_init(); int git_libgit2_shutdown(); 

Comments

Popular posts from this blog

angularjs - ADAL JS Angular- WebAPI add a new role claim to the token -

php - CakePHP HttpSockets send array of paramms -

node.js - Using Node without global install -