This is the mail archive of the java@gcc.gnu.org mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Deja Vu: multiple definition of `java::lang::String::length()'?


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.




Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]