Forum OpenACS Q&A: AOLserver C development - static vs. shared libraries?

Request notifications

I have a newbie's AOLserver C module development question:

I have a closed-source C API that I want to use from AOLserver.  Ok,
no problem, creating a myfoo.so AOLserver loadable module to do that
should be straightforward.  Unfortunately, the vendor of this
closed-source API ships only the non-shared libfoo.a version of their
library - they don't ship a libfoo.so.

Now, I should be able to just re-compile all of AOLServer with
libfoo.a linked in, right?  I think the place to do that is in
aolserver/nsd/Makefile, but I'm still a bit vague on basics like
that...  Are there any examples of static linking in the AOLserver
code that I should look at?

Also, I'm thinking that if I link libfoo.a statically into my nsd8x
binary, I can still create myfoo.so as a loadable module - there's no
reason I need to also link it statically, right?

Finally, it would be nice to avoid having to statically link libfoo.a
into nsd8x in the first place.  Is it somehow possible to link
libfoo.a into my myfoo.so, rather than nsd8x?  I don't think so, but
I'm not really sure...

Have you looked at the AOLserver Developer's Guide? I think that's the most appropriate place to look.

You should be able to link your app statically in AOLserver (I think). It would be better for you to post this question at the AOLserver list (http://listserv.aol.com).

Have you looked at the AOLserver Developer's Guide?
Yes, of course. As far as I could tell, it doesn't talk about static linking.
It would be better for you to post this question at the AOLserver list
Ok, thanks.
I for one found it simple to build a static library (libruby.a) into a shared library (ns_ruby.so) in my ns_ruby module. You can grab a tarball from it's sourceforge page and see what linking options I used to do that. Sadly I can't get to my local CVS and devel notes since during my last reloc UPS trashed my PC. After I rebuild I'll be more helpful.

If you really need to use static linking, just look at how the makefile builds nsd8x. The final make links a large number of static libraries anyway.