Thanks for the info.
I was able to link with the .a files generated as you indicated.

Because I need to run net-snmp internally via init_master_agent I have to call 
init_mib_modules.

However, even though init_mib_modules is in libnetsnmpmibs.a when I include it 
as a library in my link I get an undefined reference to `init_mib_modules()'

So what is the reason that I am not able to call this function yet I can call 
init_master_agent?

I am also unable to call init_udp, init_tcp etc..

Any info on this would be greatly appreciated.
thanks

-----Original Message-----
From: Vincent Bernat [mailto:ber...@luffy.cx] 
Sent: Tuesday, June 16, 2009 12:29 PM
To: Joan Landry
Cc: net-snmp-users@lists.sourceforge.net
Subject: Re: Port to embedded platform

OoO  Peu avant  le début  de l'après-midi  du mardi  16 juin  2009, vers 13:57, 
"Joan Landry" <joan.lan...@overturenetworks.com> disait :

> I am  trying to port  net-snmp to an  embedded platform and  have been 
> able to use ./configure and make  to cross compile the code.  Now I am 
> not  sure what  the next  step is.  I see  there are  directories that
> contain     libnetsnmpagent.la     libnetsnmp.la     libnetsnmpmibs.la
> libnetsnmptrapd.la libsnmp.la But  it is not clear to  me what files I 
> need and how to link them into my system.

Those files  are used by  libtool. Do you  want to statically  link your 
program to those libraries (you  would then need .a) or dynamically (you would 
need .so). You can also use libtool to achieve this.

> Can anyone tell me where I can find an example of this? Or give me any 
> pointers on what to do next.

> I want to be able to call the folling functions from my subagent.
>     init_agent()
>     init_mib_modules()
>     init_snmp()
>     init_master_agent()

You can use objdump -x on each .a to get this information.

init_agent() is in libnetsnmpagent.a.
0000000000000300 g     F .text  000000000000017a init_agent
init_mib_modules() is in libnetsnmpmibs.a
0000000000000000 g     F .text  0000000000000cfd init_mib_modules
init_snmp is in libnetsnmp.a
0000000000008480 g     F .text  00000000000002bd init_snmp
init_master_agent is in libnetsnmpagent.a
0000000000003220 g     F .text  000000000000041c init_master_agent

I think that for an agent, you don't need init_mib_modules(). Therefore, you 
can  just link to  libnetsnmp.a and libnetsnmpagent.a.  Depending on what you 
use in your agent, you may also need libnetsnmphelpers.a.

However,  the easiest  way to  do  this is  to link  everything. If  you 
statically link libraries, only needed bits will be included. Otherwise, use 
--as-needed flag of ld (or -Wl,--as-needed with gcc).
--
MUD IS NOT ONE OF THE 4 FOOD GROUPS
MUD IS NOT ONE OF THE 4 FOOD GROUPS
MUD IS NOT ONE OF THE 4 FOOD GROUPS
-+- Bart Simpson on chalkboard in episode 9F15

------------------------------------------------------------------------------
Crystal Reports - New Free Runtime and 30 Day Trial
Check out the new simplified licensing option that enables unlimited
royalty-free distribution of the report engine for externally facing 
server and web deployment.
http://p.sf.net/sfu/businessobjects
_______________________________________________
Net-snmp-users mailing list
Net-snmp-users@lists.sourceforge.net
Please see the following page to unsubscribe or change other options:
https://lists.sourceforge.net/lists/listinfo/net-snmp-users

Reply via email to