I have a shared library (a java JNI SO to be exact) which wraps a static library provided by another organization. I expect a newer version of the static library to be produced, but not until after I have released my code, along with the SO, to a third party. I would prefer for them to be able to link against the new version of the static library once it is released.

I can't release the source code for my application. I'm wondering if there is a way I can provide compiled or partially compiled code that can still be recompiled to link to a different static library without possessing the original source.

OK, I'm not sure if this is something I've dreamt up during some wierd geeky dream (or nightmare!) or whether I've actually seen something about this subject before.

If I have seen this somewhere, for the life of me I can't remember where it was!

Anyway, I believe that you can provide the intermediate object code (the .o or .obj files generated during compilation) and then get your users to link the object code with whatever library/libraries you're using.

So alongside the intermediate object code, you'll need to provide some sort of makefile to make the process easier for your users (possibly also some of the resources..But, not sure on that). They'll need to invoke the compiler to perform only the final link stage to link the object code with the libraries and produce the final executable.

Offhand I'm not sure which compiler switches you'll need to use to achieve this. The best bet there is to refer to the manual for your compiler as those settings will probably be compiler specific.

Sorry I can't be of any more help than that! I've never tried this myself, I'm just passing on what I remembered seeing somewhere..
Or at least what I THINK I saw somewhere!:-/

Hmm, maybe I should give it a go myself and see what happens! {contemplating.....}:?:
Cheers for now,
Jas.

p.s. If this turns out to be pure fiction, I apologise for that too! (Damn me and my strange dreams!) :S ;)

p.p.s. I found this link...
http://www.cs.cf.ac.uk/Dave/C/node3.html

Which seems to back up my theory. See the section entitled 'Some Useful Compiler Options'
This article refers to the Sun C/C++ compiler cc, but I'm certain that other compilers (GCC, VS, Borland etc) will also support similar functionality!

Sounds like your in the same boat I'm in. It seems like something that you think is vaguely possible but not really sure. To be honest I half expected a response of "no of course not; what kind of idiot are you" :$ so it's nice to get an answer that tells me I’m not completely crazy for asking.

Of course if anyone could tell me how I would go about doing it with G++ to save me the trouble of experimenting I would love you :* (yeah I just wanted an excuse to use that emote, it's cool)

This article has been dead for over six months. Start a new discussion instead.