Skip to content

Instantly share code, notes, and snippets.

@maiha
Created November 13, 2016 10:04
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save maiha/9b86bbea607be2431befe3ee63b2d539 to your computer and use it in GitHub Desktop.
Save maiha/9b86bbea607be2431befe3ee63b2d539 to your computer and use it in GitHub Desktop.
% git clone git@github.com:crystal-lang/crystal_lib.git
% cd crystal_lib
% cat > lib_ntohl.cr
@[Include("arpa/inet.h")]
lib LibC
fun ntohl
end
% crystal src/main.cr -- lib_ntohl.cr
lib LibC
alias Uint32T = LibC::UInt
fun ntohl(__netlong : Uint32T) : Uint32T
end
# got it!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment