[zeromq-dev] C++ syntax for new ZMQ objects
Claudio Carbone
erupter at libero.it
Sat Dec 15 16:28:12 CET 2012
On 15/12/12 15:49, Pieter Hintjens wrote:
> The straight C semantics are easiest to map to arbitrary languages.
> The C++ binding could have built abstractions on top but never
> accomplished this. Ironically the C binding (CZMQ) is somewhat
> higher-level than the C++ binding.
>
> -Pieter
>
Mmm ok but then I have a problem (surely because of me being a novice in
C++).
I have this in my class header
/ extern "C" {//
// #include <zmq.h>//
// #include <zhelpers.h>//
// }
rest of the class declaration follows
/
And I'm linking both the library and the program against libzmq.
Now when the program is run, it fails throwing the following error:
/ terminate called after throwing an instance of 'int'/
Following the calls, I see that my code ends up calling zmq.cpp, so I
suppose it fails because of the different objects I'm declaring and using.
But I included the C headers, and linked only against libzmq, so I don't
understand why I get the cpp library linked.
Exact failing point is in socket_base.cpp at line 323:
/ rc = parse_uri (addr_, protocol, address);
if (rc != 0)
return -1;/
Even if rc is effectively 0 (checked in GDB), the if (don't know why)
returns true.
I'm at a loss here...
Claudio
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.zeromq.org/pipermail/zeromq-dev/attachments/20121215/57ee5c5d/attachment.htm>
More information about the zeromq-dev
mailing list