You can't cast a libzmq context pointer to a CZMQ class reference. These are two different types. The shadow_ctx method does a conversion.
The use of contexts is deprecated in CZMQ/3.x. On Tue, Dec 16, 2014 at 1:30 AM, Check Peck <comptechge...@gmail.com> wrote: > Thanks a lot. Yes it worked after that change. Can you explain little bit > what does that line do and what it means in general? > > On Mon, Dec 15, 2014 at 4:26 PM, KIU Shueng Chuan <nixch...@gmail.com> > wrote: >> >> zctx_t *ctx_ptr = >> zctx_shadow_zmq_ctx ((void *)context); >> >> should do what you want. >> >> On 16 Dec 2014 06:29, "Check Peck" <comptechge...@gmail.com> wrote: >>> >>> I need to use ZeroMQ context from C++ binding to C way of ZeroMQ context >>> so when I do it like this, I get a Segmentation fault >>> >>> zctx_t* ctx_ptr = static_cast<zctx_t*>((void*)context); >>> m_auth = zauth_new (ctx_ptr); >>> >>> I am using Strawhouse security pattern by following this link - >>> http://hintjens.com/blog:49 >>> >>> >>> On Mon, Dec 15, 2014 at 1:20 PM, Check Peck <comptechge...@gmail.com> >>> wrote: >>>> >>>> I am using C++ bindings for ZeroMQ and I have declared context as - >>>> >>>> zmq::context_t& context >>>> zauth_t *m_auth; >>>> >>>> Now I am trying to use Strawhouse security pattern in my application and >>>> for which I need to czmq which is a C binding not C++ binding. >>>> >>>> Now when I try to initialize zauth like below, it always fail during >>>> compilation and I am not sure what's wrong? >>>> >>>> m_auth = zauth_new (*context); >>>> >>>> Below is the compilation error - >>>> >>>> In file included from >>>> /usr/local/include/boost/detail/container_fwd.hpp:98:0, >>>> from >>>> /usr/local/include/boost/functional/hash/extensions.hpp:17, >>>> from >>>> /usr/local/include/boost/functional/hash/hash.hpp:529, >>>> from /usr/local/include/boost/functional/hash.hpp:6, >>>> from >>>> /usr/local/include/boost/regex/v4/basic_regex.hpp:23, >>>> from /usr/local/include/boost/regex/v4/regex.hpp:67, >>>> from /usr/local/include/boost/regex.hpp:31, >>>> from /home/david/ZeroMQTester/test_queue.cpp:7: >>>> /usr/include/c++/4.7/complex:379:5: note: template<class _Tp> >>>> std::complex<_Tp> std::operator*(const std::complex<_Tp>&, const >>>> std::complex<_Tp>&) >>>> /usr/include/c++/4.7/complex:379:5: note: template argument >>>> deduction/substitution failed: >>>> /home/david/ZeroMQTester/test_queue.cpp:126:26: note: âzmq::context_tâ >>>> is not derived from âconst std::complex<_Tp>â >>>> >>> >>> _______________________________________________ >>> zeromq-dev mailing list >>> zeromq-dev@lists.zeromq.org >>> http://lists.zeromq.org/mailman/listinfo/zeromq-dev >>> >> >> _______________________________________________ >> zeromq-dev mailing list >> zeromq-dev@lists.zeromq.org >> http://lists.zeromq.org/mailman/listinfo/zeromq-dev >> > > _______________________________________________ > zeromq-dev mailing list > zeromq-dev@lists.zeromq.org > http://lists.zeromq.org/mailman/listinfo/zeromq-dev > _______________________________________________ zeromq-dev mailing list zeromq-dev@lists.zeromq.org http://lists.zeromq.org/mailman/listinfo/zeromq-dev