Deja Vu: multiple definition of `java::lang::String::length()'?
Bryce McKinlay
bryce@waitaki.otago.ac.nz
Mon Mar 11 16:35:00 GMT 2002
Adam Megacz wrote:
>This is actually caused by gcjh -- it generates a function body for
>simple functions, like this:
>> jint length () { return count; }
>>Now this is cool, since it lets gcc inline simple methods, but OTOH it
>causes link failures since you now have two definitions of
>java::lang::String::length() (one in C++ from the headers, and one in
>Java from String.java).
>
Aah, ok. Presumably you are compiling without -O, otherwise it would get
inlined and there wouldn't be a problem?
>Is this only a problem on mingw due to lack of weak symbols? I haven't
>tried it on any other platforms. Sticking an 'inline' in front of the
>jint doesn't help, and C++ doesn't provide a way to specify internal
>linkage for a method ('static' has a different meaning for methods
>than for functions, AFAICT).
>
How about __attribute__ ((always_inline)) ?
regards
Bryce.
More information about the Java
mailing list