Skip to content

Commit

Permalink
Expose zmq library version
Browse files Browse the repository at this point in the history
  • Loading branch information
FROGGS committed Mar 27, 2018
1 parent 81296f1 commit 3511b0a
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions lib/Net/ZMQ4/Util.pm6
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
unit module Net::ZMQ4::Util;
unit class Net::ZMQ4::Util;

use NativeCall;

# ZMQ_EXPORT void zmq_version (int *major, int *minor, int *patch);
sub zmq_version(CArray[int32], CArray[int32], CArray[int32]) is native('zmq',v5) { * }
our sub zmq_version(int32 is rw, int32 is rw, int32 is rw) is native('zmq',v5) { * }
# ZMQ_EXPORT int zmq_errno (void);
sub zmq_errno(--> int32) is native('zmq',v5) { * }
# ZMQ_EXPORT const char *zmq_strerror (int errnum);
Expand All @@ -25,4 +25,12 @@ my sub zmq_die() is export {

our $context-count is export = 0;

method library-version {
my int32 $major = 0;
my int32 $minor = 0;
my int32 $patch = 0;
zmq_version($major, $minor, $patch);
Version.new($major ~ '.' ~ $minor ~ '.' ~ $patch);
}

# vim: ft=perl6

0 comments on commit 3511b0a

Please sign in to comment.