[Snort-devel] how to make snort paengine shared objects (fwd)

Todd Lewis tlewis at ...120...
Mon Jan 1 14:23:01 EST 2001


This has always been really hard for me to figure out how to do,
and this time was no exception.  On the off chance that other people
want to experiment with making shared objects suited for opening with
dlopen, here's how you do it under Linux with gcc.  On other platforms,
your mileage may vary.  These steps yield, in this case, the file
"paengine_pcap.so".

PAE=pcap
gcc -g -O2 -Wall -c paengine_${PAE}.c -fPIC -DPIC -o paengine_${PAE}.lo
gcc -shared paengine_${PAE}.lo -lc -Wl,-soname -Wl,paengine_${PAE}.so -o paengine_${PAE}.so

For my netfilter paengine, I have to link in libipq.  I place it in the
local directory, since it's not a standard system component.  Here's how
that second step looks with the addition of "-L. -lipq":

PAE=netfilter
gcc -shared paengine_${PAE}.lo -L. -lipq -lc -Wl,-soname -Wl,paengine_${PAE}.so -o paengine_${PAE}.so

libtool gives you a cross-platform way to accomplish this goal (just
running these commands on Linux), but it's complicated and I like seeing
how this stuff really works, so here you go.

--
Todd Lewis                                       tlewis at ...120...

  God grant me the courage not to give up what I think is right, even
  though I think it is hopeless.          - Admiral Chester W. Nimitz





More information about the Snort-devel mailing list