Hi Magnus,
Thanks for your reply.
Not that I am aware of.
When I am to generate a small shared object for testing I usually do as
follows:
net-snmp-config --compile-subagent scalar_int \
/path/to/src/net-snmp/agent/mibgroup/examples/scalar_int.c
in order to get myself a nice command line. This command outputs
generating the tmporary code file: netsnmptmp.14888.c
checking for init_scalar_int in
/path/to/src/net-snmp/agent/mibgroup/examples/scalar_int.c
init_scalar_int(void)
checking for shutdown_scalar_int in
/path/to/src/net-snmp/agent/mibgroup/examples/scalar_int.c
running:
gcc -DNETSNMP_ENABLE_IPV6 -g -Ulinux -Dlinux=linux -I/usr/include/rpm -Wall
-Winline -Wstrict-prototypes -Wwrite-strings -Wcast-qual -Wno-char-subscripts
-I. -I/path/to/include -o scalar_int netsnmptmp.14888.c
/path/to/src/net-snmp/agent/mibgroup/examples/scalar_int.c -L/path/to/lib
-lnetsnmpagent -lnetsnmphelpers -lnetsnmpmibs -lnetsnmp
netsnmptmp.14888.c: In function 'main':
netsnmptmp.14888.c:200: warning: implicit declaration of function
'init_scalar_int'
removing the tmporary code file: netsnmptmp.14888.c
subagent program scalar_int created
From this I take the line running: gcc ... and modifies it by removing
the temp file, changing the name of the output file and adding the
-shared option as follows:
gcc -DNETSNMP_ENABLE_IPV6 -g -Ulinux -Dlinux=linux \
-I/usr/include/rpm -Wall -Winline -Wstrict-prototypes -Wwrite-strings \
-Wcast-qual -Wno-char-subscripts -I. -I/path/to/include \
-o scalar_int.so -shared \
/path/to/src/net-snmp/agent/mibgroup/examples/scalar_int.c \
-L/path/to/lib -lnetsnmpagent -lnetsnmphelpers \
-lnetsnmpmibs -lnetsnmp
/MF
Is this method also feasible for template codes generated from a table
(mib2c -c mib2c.mfd.conf xxxtable).
How can I modify it?
I use mib2c to generate tempalate codes. ==> mib2c -c mib2c.mfd.conf
vdslLineTable
Then I got following files:
vdslLineTable-README-FIRST.txt
vdslLineTable-README-vdslLineTable.txt
vdslLineTable.c
vdslLineTable.h
vdslLineTable_data_access.c
vdslLineTable_data_access.h
vdslLineTable_data_get.c
vdslLineTable_data_get.h
vdslLineTable_data_set.c
vdslLineTable_data_set.h
vdslLineTable_enums.h
vdslLineTable_interface.c
vdslLineTable_interface.h
vdslLineTable_oids.h
These files are expected when we run "mib2c -c mib2c.mfd.conf xxxtable".
So I think there should be a template makefile can be referenced.
Thanks,
永鈦鑫 iTAS Corporation
新竹科學園區工業東三路6號
NO. 6, Industry E. Rd. III, Science Park, Hsin-Chu, Taiwan 300, R.O.C.
Tel:03-6662595 Ext.1208
E-mail:[EMAIL PROTECTED]
----- Original Message -----
From: "Magnus Fromreide" <[EMAIL PROTECTED]>
To: "Tewen Hsieh" <[EMAIL PROTECTED]>
Cc: <[email protected]>
Sent: Tuesday, May 20, 2008 1:12 PM
Subject: Re: about makefile of dynamic module
On tis, 2008-05-20 at 09:40 +0800, Tewen Hsieh wrote:
Hi,
as title~
I am not familiar with writing makefile.
There is just a scalar sample can be found at net-snmp
tutorials(http://net-snmp.sourceforge.net/wiki/index.php/Tutorials).
If I want to write a dynamic loadable object of a table (ex: ifTable),
how can I write the makefile?
Is there a makefile template can be referenced?
Not that I am aware of.
When I am to generate a small shared object for testing I usually do as
follows:
net-snmp-config --compile-subagent scalar_int \
/path/to/src/net-snmp/agent/mibgroup/examples/scalar_int.c
in order to get myself a nice command line. This command outputs
generating the tmporary code file: netsnmptmp.14888.c
checking for init_scalar_int in
/path/to/src/net-snmp/agent/mibgroup/examples/scalar_int.c
init_scalar_int(void)
checking for shutdown_scalar_int in
/path/to/src/net-snmp/agent/mibgroup/examples/scalar_int.c
running:
gcc -DNETSNMP_ENABLE_IPV6 -g -Ulinux -Dlinux=linux -I/usr/include/rpm -Wall
-Winline -Wstrict-prototypes -Wwrite-strings -Wcast-qual -Wno-char-subscripts
-I. -I/path/to/include -o scalar_int netsnmptmp.14888.c
/path/to/src/net-snmp/agent/mibgroup/examples/scalar_int.c -L/path/to/lib
-lnetsnmpagent -lnetsnmphelpers -lnetsnmpmibs -lnetsnmp
netsnmptmp.14888.c: In function 'main':
netsnmptmp.14888.c:200: warning: implicit declaration of function
'init_scalar_int'
removing the tmporary code file: netsnmptmp.14888.c
subagent program scalar_int created
From this I take the line running: gcc ... and modifies it by removing
the temp file, changing the name of the output file and adding the
-shared option as follows:
gcc -DNETSNMP_ENABLE_IPV6 -g -Ulinux -Dlinux=linux \
-I/usr/include/rpm -Wall -Winline -Wstrict-prototypes -Wwrite-strings \
-Wcast-qual -Wno-char-subscripts -I. -I/path/to/include \
-o scalar_int.so -shared \
/path/to/src/net-snmp/agent/mibgroup/examples/scalar_int.c \
-L/path/to/lib -lnetsnmpagent -lnetsnmphelpers \
-lnetsnmpmibs -lnetsnmp
/MF
--
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.
--
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Net-snmp-coders mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders