casio car
casio car

Reputation: 129

Template code missing from static library on AIX platform

I have a static library "static_library.a" that contains the following objects (verified through "ar tv") on AIX system:

When I link with "static_library.a", I get errors due to missing (template) code from "template_code.cpp"

This only happens on AIX (It works on SGI and SUN)

I've already looked up the AIX compiler documentation regarding templates.

Note: 1. I cannot use shared object

What am I missing?

Upvotes: 0

Views: 102

Answers (1)

Juan
Juan

Reputation: 3775

Automatic template instantiation may be problematic on different platforms. You can try and do a manual instantiation of the classes.

The syntax is available online from various sources.

For example: http://www.devx.com/tips/Tip/12652

The explicit instantiation should be done at the bottom of the file which defines all of the methods.

Another approach is to make the full template source code available to object code outside of your static library.

I don't have access to that compiler, but this page from IBM recommends explicit template instantiation for libraries. ftp://ftp.software.ibm.com/software/rational/docs/docset/doc/cpf_4.2/ccase_ux/ccbuild/ccbuild-69.html

Of course, I'm excluding the possibility that you are using a one pass linker, and that need the static library would have to be in the correct order on the linker line.

Upvotes: 1

Related Questions