On Fri, 2013-10-04 at 09:31 -0400, Frozen Puck wrote:
> I took Magnus' advice and saved the intermediate C files, comparing
> the one generated for the C version vs the one for C++. As it turns
> out, for whatever reason, the C++ version was missing the call to
> init_<my_OID>()
> 
> 
> SO I added the call where it should be and produced .o's for the
> intermediate and cpp, then used g++ to link them.  The resulting
> sub-agent would run and get into its handle_xxx()/MODE_GET until a C++
> library method  threw an exception and the entire thing crashed.  It
> did not even make it to its defined handler or the catch(...) which
> leads me to thing that that is due to mixed mode linkages (nothing
> relating to net-snmp).  Long story short: this most probably can be
> resolved but I can't waste any more time on getting the net-snmp
> sub-agents to work in a C++ environment.  If someone has a very quick
> solution I could put some time aside to try it, but otherwise I'll
> just restrict my work to C only (ick).
> 
Well, that is one of the bad parts of interfacing C and C++, you can't
throw through C code without extra care - in the case of GCC I think the
extra care is spelled "-fexception" but you need to apply it to the
build of the Net-SNMP libraries, and you are still likely to trigger
resource leaks in the C part.

With that said I admit to using the Net-SNMP libraries from C++ myself.

I assume that catching everything in your handler functions, and thus
not throwing through the C parts, is unfeasible for you?

> 
> tack själv! Magnus!

Lycka till.

/MF



------------------------------------------------------------------------------
October Webinars: Code for Performance
Free Intel webinars can help you accelerate application performance.
Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most from 
the latest Intel processors and coprocessors. See abstracts and register >
http://pubads.g.doubleclick.net/gampad/clk?id=60134791&iu=/4140/ostg.clktrk
_______________________________________________
Net-snmp-coders mailing list
Net-snmp-coders@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders

Reply via email to