On 07/07/07, Farokh Irani <[EMAIL PROTECTED]> wrote:
>On 06/07/07, Farokh Irani <[EMAIL PROTECTED]> wrote:
>>I'm trying to link together a couple of .o files into a .so file
>>using g++. The problem is that even though I have a -o specified, no
>>file is generated and no error comes up. Any pointers on how to
>>figure out what might be going on, or even where I could look for
>>more info, would be appreciated.
>>
>>This is with g++ 4.0.1 on Mac OS X 10.4.10.
>
>If you are trying to create an Apache module .so, why aren't you using apxs?
>
>You can specify that g++ should be used instead of gcc by saying:
>
> apxs -S CC=g++ -c mod_example.c
>
>This is much better and more portable than trying to create the .so
>yourself. This is more so the case on MacOS X as how you build a
>dynamically loadable module is different to options you would use for
>other platforms. Also, on MacOS X a dynamically loadable module has to
>be created in a different way to a shared library, they are not
>interchangeable.
OK, I'm willing to give that a shot, but how do I use apxs to
compile/link a multi-file source module? IE Right now I've got a
small module that has 3 files, but I expect the source tree to grow
to many more (possibly a hundred or more source files).
Look at the manual page for 'apxs' on your system.
If you have lots of non Apache specific modules then compile them with
g++ direct if you want, but then compile Apache specific stuff with:
apxs -S CC=g++ -c mod_foo.c file1.c file2.c object1.o object2.o
The apxs command can be given code files or existing compiled object
files (I think).
You could also put your non Apache specific files in a library and
link to that library when building the module.
apxs -S CC=g++ -c mod_foo.c file1.c file2.c -lmylibrary
The important bit is using apxs for the compilation of Apache code
files and doing the final link to get the Apache module .so.
Graham