#47 template specialization in javacast.tsd

closed-fixed
nobody
None
5
2004-12-04
2004-02-07
Daniel
No

My project uses jace::java_cast in two different cpp
files. This cases a duplicate symbol link error in Visual
Studio.NET, and it's because of template specialization
in javacast.tsd. Someone else had a similar problem
(see http://dbforums.com/arch/89/2002/4/346670 ).

To fix this, you need to modify javacast.tsd as follows:

template <> jobject java_cast<jobject>(
const ::jace::proxy::JObject&
obj ) {
return obj.getJavaJniObject();

Should be

template <> jobject inline java_cast<jobject>( const
::jace::proxy::JObject& obj ) {
return obj.getJavaJniObject();

Can you fix this for your next release?
Thanks,
Daniel

Discussion

  • Daniel

    Daniel - 2004-02-07

    Logged In: YES
    user_id=198662

    One other thing I'd like to suggest as a safety measure
    related to this bug--could you please add a

    #ifndef JAVA_CAST_H
    #define JAVA_CAST_H
    ...
    #endif

    around everything in javacast.h? This would protect against
    re-includes.
    Thanks,
    Daniel

     
  • Toby Reyelts

    Toby Reyelts - 2004-02-07

    Logged In: YES
    user_id=149785

    Hi Daniel,

    You shouldn't be including java_cast.tsd directly (or any other
    file that ends with .tsd or .tsp). It does look like I managed to
    forget the include guards on javacast.h, though.

    If the missing include guards didn't cause your other problem,
    it looks like VC++ may not require the same special handling
    for template function specialiations that it requires for
    template member function specializations. I'll have to test this
    out with both 6.0 and 7.0+.

    Thanks for pointing these problems out.

    God bless,
    -Toby Reyelts

     
  • Daniel

    Daniel - 2004-02-07

    Logged In: YES
    user_id=198662

    Just to clarify--I wasn't including javacast.tsd--I included
    only javacast.h. And the missing include guards didn't cause
    problem (I just pointed it out as matter of form). Yes, Visual
    Studio .net seems to require the special handling
    for template function specialiations. When I modified
    javacast.tsd by adding the "inline", the linking problem goes
    away.

     
  • Nobody/Anonymous

    Logged In: NO

    Daniel,

    I am a new developer helping Toby with JACE and I have just
    fixed this bug. Thanks for your report!

    Gili

     
  • Gili Tzabari

    Gili Tzabari - 2004-12-04

    Logged In: YES
    user_id=80628

    Fixed in Jace 1.1 RC1_05. Thank you for your report.

     
  • Gili Tzabari

    Gili Tzabari - 2004-12-04
    • status: open --> closed-fixed
     

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks