New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BridJ: CPP Inheritance #346

Closed
DarkKnight178 opened this Issue Dec 4, 2012 · 5 comments

Comments

Projects
None yet
2 participants
@DarkKnight178

DarkKnight178 commented Dec 4, 2012

Hi! In advance sorry for my english, it's not native language for me.
I try create work project with native CPP classes. And i make this,but...if i create only inherited objects - all is ok, but if I also create other native objects, a have error:

Java Result: -1073741819

My CPP code:

class TEST_API TestClass
{
public:
    TestClass();
    ~TestClass();

    void PrintText(string text);
    void PrintString();

    int GetInt();
    void SetInt(int val);

    const char* GetString();
    char* GetCharPtr();

    const wchar_t* GetWString();
    wchar_t* GetWCharPtr();

    void SetString(string str);
    void SetCharPtr(char* characters);

    void SetWString(wstring wstr);
    void SetWCharPtr(wchar_t* wide_characters);

protected:
    int mInt;

    string mString;
    char* mCharPtr;

    wstring mWString;
    wchar_t* mWCharPtr;
};

class TEST_API BasedClass
{
public:
    BasedClass();
    ~BasedClass();

    void CommonMethod();

    void CommonMethod2();

protected:
    int mA;
};


class TEST_API InheritsClass : public BasedClass
{
    InheritsClass();
    ~InheritsClass();
};

Horewer,with declarations.

Java code:

@Library("TestDLL") 
@Runtime(CPPRuntime.class) 
public class TestClass extends CPPObject {

    public TestClass() {
        super();
    }

        //...
}


public class InheritsClass extends BasedClass {

    public InheritsClass() {
            super();
    }

    public InheritsClass(Pointer pointer) {
            super(pointer);
    }
};


@Library("TestDLL") 
@Runtime(CPPRuntime.class) 
public class BasedClass extends CPPObject {

    public BasedClass() {
            super();
    }

    public BasedClass(Pointer pointer) {
            super(pointer);
    }

    native public void CommonMethod();

    native public void CommonMethod2();
};

main function:

        // inherit test
        InheritsClass _inheritClass = new InheritsClass();
        _inheritClass.CommonMethod();

        // class test #1
        TestClass testClass = new TestClass();

where the error?

@DarkKnight178

This comment has been minimized.

Show comment
Hide comment
@DarkKnight178

DarkKnight178 Dec 4, 2012

I think problem in differents between GCC and MSVS. I compile with MSVS. May be VTable in BridJ represent such as GCC? I am create other like class and it work. I think problem in Vtable <-> BridJ.

DarkKnight178 commented Dec 4, 2012

I think problem in differents between GCC and MSVS. I compile with MSVS. May be VTable in BridJ represent such as GCC? I am create other like class and it work. I think problem in Vtable <-> BridJ.

@ochafik

This comment has been minimized.

Show comment
Hide comment
@ochafik

ochafik Jan 8, 2013

Member

Hi @DarkKnight178 ,

Thanks for your report!
Your two classes don't have any virtual table, for they don't have a virtual destructor nor any virtual method.

I suggest you try making the destructors virtual and/or make your methods virtual, and paste the detailed error logs you're getting with BRIDJ_VERBOSE=1 :-)

Cheers

Member

ochafik commented Jan 8, 2013

Hi @DarkKnight178 ,

Thanks for your report!
Your two classes don't have any virtual table, for they don't have a virtual destructor nor any virtual method.

I suggest you try making the destructors virtual and/or make your methods virtual, and paste the detailed error logs you're getting with BRIDJ_VERBOSE=1 :-)

Cheers

@DarkKnight178

This comment has been minimized.

Show comment
Hide comment
@DarkKnight178

DarkKnight178 Jan 22, 2013

Thank you for support!
Log:

Hello world!
янв 22, 2013 11:28:41 AM org.bridj.BridJ log
INFO: Environment var LD_LIBRARY_PATH = null
янв 22, 2013 11:28:41 AM org.bridj.BridJ log
INFO: Environment var DYLD_LIBRARY_PATH = null
янв 22, 2013 11:28:41 AM org.bridj.BridJ log
INFO: Environment var PATH = C:\Program Files (x86)\AMD APP\bin\x86_64;C:\Program Files (x86)\AMD APP\bin\x86;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\ATI Technologies\ATI.ACE\Core-Static;C:\Program Files (x86)\Microsoft SQL Server\100\Tools\Binn\;C:\Program Files\Microsoft SQL Server\100\Tools\Binn\;C:\Program Files\Microsoft SQL Server\100\DTS\Binn\;C:\Program Files\TortoiseSVN\bin;C:\Program Files (x86)\Visual Leak Detector\bin\Win32;C:\Program Files (x86)\Visual Leak Detector\bin\Win64;C:\Program Files (x86)\Microsoft ASP.NET\ASP.NET Web Pages\v1.0\;C:\Program Files\Microsoft SQL Server\110\Tools\Binn\;C:\Program Files (x86)\Java\jdk1.7.0_09\bin;C:\Program Files\Microsoft\Web Platform Installer\;C:\Program Files (x86)\Windows Kits\8.0\Windows Performance Toolkit\
янв 22, 2013 11:28:41 AM org.bridj.BridJ log
INFO: Property java.library.path = C:\Program Files (x86)\Java\jdk1.7.0_09\bin;C:\Windows\Sun\Java\bin;C:\Windows\system32;C:\Windows;C:\Program Files (x86)\AMD APP\bin\x86_64;C:\Program Files (x86)\AMD APP\bin\x86;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\ATI Technologies\ATI.ACE\Core-Static;C:\Program Files (x86)\Microsoft SQL Server\100\Tools\Binn\;C:\Program Files\Microsoft SQL Server\100\Tools\Binn\;C:\Program Files\Microsoft SQL Server\100\DTS\Binn\;C:\Program Files\TortoiseSVN\bin;C:\Program Files (x86)\Visual Leak Detector\bin\Win32;C:\Program Files (x86)\Visual Leak Detector\bin\Win64;C:\Program Files (x86)\Microsoft ASP.NET\ASP.NET Web Pages\v1.0\;C:\Program Files\Microsoft SQL Server\110\Tools\Binn\;C:\Program Files (x86)\Java\jdk1.7.0_09\bin;C:\Program Files\Microsoft\Web Platform Installer\;C:\Program Files (x86)\Windows Kits\8.0\Windows Performance Toolkit\;.
янв 22, 2013 11:28:41 AM org.bridj.BridJ log
INFO: Property gnu.classpath.boot.library.path = null
янв 22, 2013 11:28:41 AM org.bridj.BridJ log
INFO: Loaded library 'TestDLL' from 'D:\Java\Test\TestDLL.dll'
янв 22, 2013 11:28:41 AM org.bridj.BridJ log
INFO: No fields found in test.InheritsClass (maybe they weren't declared as public ?)
янв 22, 2013 11:28:41 AM org.bridj.BridJ log
INFO: No fields found in org.bridj.cpp.CPPRuntime$CPPDestructor (maybe they weren't declared as public ?)
янв 22, 2013 11:28:41 AM org.bridj.BridJ log
INFO: No fields found in org.bridj.cpp.CPPRuntime_CPPDestructor_NativeImpl (maybe they weren't declared as public ?)
янв 22, 2013 11:28:41 AM org.bridj.BridJ log
INFO: No fields found in org.bridj.dyncallbacks.PointerToVoid_0 (maybe they weren't declared as public ?)
mA = 2
mA = 10101001
янв 22, 2013 11:28:41 AM org.bridj.BridJ log
INFO: No fields found in test.BasedClass (maybe they weren't declared as public ?)
mA = 1
янв 22, 2013 11:28:41 AM org.bridj.BridJ log
INFO: No fields found in test.TestClassInheritance (maybe they weren't declared as public ?)
123
777
trololo!
янв 22, 2013 11:28:41 AM org.bridj.BridJ log
INFO: No fields found in test.SecondTestClass (maybe they weren't declared as public ?)
0

It write "no fields", but I do not want fields in these classes!

And I give you link on my sources(maybe I'm doing something wrong?):
http://depositfiles.com/files/oyaslom6s

DarkKnight178 commented Jan 22, 2013

Thank you for support!
Log:

Hello world!
янв 22, 2013 11:28:41 AM org.bridj.BridJ log
INFO: Environment var LD_LIBRARY_PATH = null
янв 22, 2013 11:28:41 AM org.bridj.BridJ log
INFO: Environment var DYLD_LIBRARY_PATH = null
янв 22, 2013 11:28:41 AM org.bridj.BridJ log
INFO: Environment var PATH = C:\Program Files (x86)\AMD APP\bin\x86_64;C:\Program Files (x86)\AMD APP\bin\x86;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\ATI Technologies\ATI.ACE\Core-Static;C:\Program Files (x86)\Microsoft SQL Server\100\Tools\Binn\;C:\Program Files\Microsoft SQL Server\100\Tools\Binn\;C:\Program Files\Microsoft SQL Server\100\DTS\Binn\;C:\Program Files\TortoiseSVN\bin;C:\Program Files (x86)\Visual Leak Detector\bin\Win32;C:\Program Files (x86)\Visual Leak Detector\bin\Win64;C:\Program Files (x86)\Microsoft ASP.NET\ASP.NET Web Pages\v1.0\;C:\Program Files\Microsoft SQL Server\110\Tools\Binn\;C:\Program Files (x86)\Java\jdk1.7.0_09\bin;C:\Program Files\Microsoft\Web Platform Installer\;C:\Program Files (x86)\Windows Kits\8.0\Windows Performance Toolkit\
янв 22, 2013 11:28:41 AM org.bridj.BridJ log
INFO: Property java.library.path = C:\Program Files (x86)\Java\jdk1.7.0_09\bin;C:\Windows\Sun\Java\bin;C:\Windows\system32;C:\Windows;C:\Program Files (x86)\AMD APP\bin\x86_64;C:\Program Files (x86)\AMD APP\bin\x86;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\ATI Technologies\ATI.ACE\Core-Static;C:\Program Files (x86)\Microsoft SQL Server\100\Tools\Binn\;C:\Program Files\Microsoft SQL Server\100\Tools\Binn\;C:\Program Files\Microsoft SQL Server\100\DTS\Binn\;C:\Program Files\TortoiseSVN\bin;C:\Program Files (x86)\Visual Leak Detector\bin\Win32;C:\Program Files (x86)\Visual Leak Detector\bin\Win64;C:\Program Files (x86)\Microsoft ASP.NET\ASP.NET Web Pages\v1.0\;C:\Program Files\Microsoft SQL Server\110\Tools\Binn\;C:\Program Files (x86)\Java\jdk1.7.0_09\bin;C:\Program Files\Microsoft\Web Platform Installer\;C:\Program Files (x86)\Windows Kits\8.0\Windows Performance Toolkit\;.
янв 22, 2013 11:28:41 AM org.bridj.BridJ log
INFO: Property gnu.classpath.boot.library.path = null
янв 22, 2013 11:28:41 AM org.bridj.BridJ log
INFO: Loaded library 'TestDLL' from 'D:\Java\Test\TestDLL.dll'
янв 22, 2013 11:28:41 AM org.bridj.BridJ log
INFO: No fields found in test.InheritsClass (maybe they weren't declared as public ?)
янв 22, 2013 11:28:41 AM org.bridj.BridJ log
INFO: No fields found in org.bridj.cpp.CPPRuntime$CPPDestructor (maybe they weren't declared as public ?)
янв 22, 2013 11:28:41 AM org.bridj.BridJ log
INFO: No fields found in org.bridj.cpp.CPPRuntime_CPPDestructor_NativeImpl (maybe they weren't declared as public ?)
янв 22, 2013 11:28:41 AM org.bridj.BridJ log
INFO: No fields found in org.bridj.dyncallbacks.PointerToVoid_0 (maybe they weren't declared as public ?)
mA = 2
mA = 10101001
янв 22, 2013 11:28:41 AM org.bridj.BridJ log
INFO: No fields found in test.BasedClass (maybe they weren't declared as public ?)
mA = 1
янв 22, 2013 11:28:41 AM org.bridj.BridJ log
INFO: No fields found in test.TestClassInheritance (maybe they weren't declared as public ?)
123
777
trololo!
янв 22, 2013 11:28:41 AM org.bridj.BridJ log
INFO: No fields found in test.SecondTestClass (maybe they weren't declared as public ?)
0

It write "no fields", but I do not want fields in these classes!

And I give you link on my sources(maybe I'm doing something wrong?):
http://depositfiles.com/files/oyaslom6s

@DarkKnight178

This comment has been minimized.

Show comment
Hide comment
@DarkKnight178

DarkKnight178 Jan 22, 2013

Another log. It is other project. It can not creating CAttribute class objects.

янв 22, 2013 5:51:04 PM org.bridj.BridJ log
INFO: No fields found in nativehtmltokenizer.CTokenizer (maybe they weren't declared as public ?)
янв 22, 2013 5:51:04 PM org.bridj.BridJ log
INFO: Environment var LD_LIBRARY_PATH = null
янв 22, 2013 5:51:04 PM org.bridj.BridJ log
INFO: Environment var DYLD_LIBRARY_PATH = null
янв 22, 2013 5:51:04 PM org.bridj.BridJ log
INFO: Environment var PATH = C:\Program Files (x86)\AMD APP\bin\x86_64;C:\Program Files (x86)\AMD APP\bin\x86;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\ATI Technologies\ATI.ACE\Core-Static;C:\Program Files (x86)\Microsoft SQL Server\100\Tools\Binn\;C:\Program Files\Microsoft SQL Server\100\Tools\Binn\;C:\Program Files\Microsoft SQL Server\100\DTS\Binn\;C:\Program Files\TortoiseSVN\bin;C:\Program Files (x86)\Visual Leak Detector\bin\Win32;C:\Program Files (x86)\Visual Leak Detector\bin\Win64;C:\Program Files (x86)\Microsoft ASP.NET\ASP.NET Web Pages\v1.0\;C:\Program Files\Microsoft SQL Server\110\Tools\Binn\;C:\Program Files (x86)\Java\jdk1.7.0_09\bin;C:\Program Files\Microsoft\Web Platform Installer\;C:\Program Files (x86)\Windows Kits\8.0\Windows Performance Toolkit\
янв 22, 2013 5:51:04 PM org.bridj.BridJ log
INFO: Property java.library.path = C:\Program Files (x86)\Java\jdk1.7.0_09\bin;C:\Windows\Sun\Java\bin;C:\Windows\system32;C:\Windows;C:\Program Files (x86)\AMD APP\bin\x86_64;C:\Program Files (x86)\AMD APP\bin\x86;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\ATI Technologies\ATI.ACE\Core-Static;C:\Program Files (x86)\Microsoft SQL Server\100\Tools\Binn\;C:\Program Files\Microsoft SQL Server\100\Tools\Binn\;C:\Program Files\Microsoft SQL Server\100\DTS\Binn\;C:\Program Files\TortoiseSVN\bin;C:\Program Files (x86)\Visual Leak Detector\bin\Win32;C:\Program Files (x86)\Visual Leak Detector\bin\Win64;C:\Program Files (x86)\Microsoft ASP.NET\ASP.NET Web Pages\v1.0\;C:\Program Files\Microsoft SQL Server\110\Tools\Binn\;C:\Program Files (x86)\Java\jdk1.7.0_09\bin;C:\Program Files\Microsoft\Web Platform Installer\;C:\Program Files (x86)\Windows Kits\8.0\Windows Performance Toolkit\;.
янв 22, 2013 5:51:04 PM org.bridj.BridJ log
INFO: Property gnu.classpath.boot.library.path = null
янв 22, 2013 5:51:04 PM org.bridj.BridJ log
INFO: Loaded library 'JavaTokenizerDLL' from 'D:\Java\NativeHTMLTokenizer\JavaTokenizerDLL.dll'
янв 22, 2013 5:51:04 PM org.bridj.BridJ log
INFO: Symbol parsing failed : Reached end of string '?GetState@CTokenizer@Parser@@QBE?AW4EState@2@XZ' (in symbol '?GetState@CTokenizer@Parser@@QBE?AW4EState@2@XZ')
янв 22, 2013 5:51:05 PM org.bridj.BridJ log
INFO: No fields found in org.bridj.cpp.CPPRuntime$CPPDestructor (maybe they weren't declared as public ?)
янв 22, 2013 5:51:05 PM org.bridj.BridJ log
INFO: No fields found in org.bridj.cpp.CPPRuntime_CPPDestructor_NativeImpl (maybe they weren't declared as public ?)
янв 22, 2013 5:51:05 PM org.bridj.BridJ log
INFO: No fields found in org.bridj.dyncallbacks.PointerToVoid_0 (maybe they weren't declared as public ?)
янв 22, 2013 5:51:20 PM org.bridj.BridJ log
INFO: No fields found in nativehtmltokenizer.CToken (maybe they weren't declared as public ?)
янв 22, 2013 5:51:20 PM org.bridj.BridJ log
INFO: Symbol parsing failed : Reached end of string '?GetType@CToken@HTML@@UBE?AW4ETokenType@2@XZ' (in symbol '?GetType@CToken@HTML@@UBE?AW4ETokenType@2@XZ')
янв 22, 2013 5:51:20 PM org.bridj.BridJ log
INFO: Failed to find a vtable for type nativehtmltokenizer.CToken
_name = 
_tokenType = 6
янв 22, 2013 5:51:40 PM org.bridj.BridJ log
INFO: No fields found in nativehtmltokenizer.CStdToken (maybe they weren't declared as public ?)
янв 22, 2013 5:51:40 PM org.bridj.BridJ log
INFO: Symbol parsing failed : Reached end of string '?GetAttribute@CStdToken@HTML@@QBEPAVCAttribute@2@I@Z' (in symbol '?GetAttribute@CStdToken@HTML@@QBEPAVCAttribute@2@I@Z')
_name = 
value = ⋚︀
attributes count = 0
Java Result: -1073740940
СБОРКА УСПЕШНО ЗАВЕРШЕНА (общее время: 1 минута 9 секунды)

And it say "Failed to find a vtable for type nativehtmltokenizer.CToken", but CToken have VTable! I'm try not using AToken, I thought it is solve this problem, but nothing has changed.

CPP AToken:

class EXPORT AToken
{
protected:
    AToken() { /* empty */ }
public:
    virtual ~AToken() { /* empty */ }

    virtual ETokenType GetType() const = 0;
};

Java AToken:

@Library("JavaTokenizerDLL") 
@Runtime(CPPRuntime.class) 
public class AToken extends CPPObject {
        static {
            BridJ.register();
        }

        public AToken() {
                super();
        }

        public AToken(Pointer pointer) {
                super(pointer);
        }

        //@Virtual(0)
       //public native void ATokenDestructor();

        //@Virtual(1)
        native public ETokenType GetType();
};

CPP CToken:

class EXPORT CToken : public AToken
{
public:
    CToken();
    ~CToken() override;

    virtual ETokenType GetType() const final;

    void SetName(const DString& name);
    DString GetName() const;

    void AppendToName(wchar_t character);
    void AppendToName(const DString& str);

#ifdef EXPORT_IN_JAVA
    void jSetName(const wchar_t* name);
    const wchar_t* jGetName() const;

    void jAppendToName(const wchar_t* str);
#endif

protected:
    DString mName;
    ETokenType mType;
};

Java CToken:

@Library("JavaTokenizerDLL")
@Runtime(CPPRuntime.class) 
public class CToken extends CPPObject {
        static {
            BridJ.register();
        }

    public CToken() {
        super();
    }
        public CToken(Pointer pointer) {
        super(pointer);
    }

        //@Virtual(0) // TODO
        //public native void CTokenDestructor();

        @Virtual(1) // TODO
        //@Override
    native public ETokenType GetType();

        native public void jSetName(Pointer<Character > name);
    native public Pointer<Character > jGetName();

    native public void AppendToName(char character);
    native public void jAppendToName(Pointer<Character > str);
}

What I do not correct?
In MSVC project settings optimization is off.

DarkKnight178 commented Jan 22, 2013

Another log. It is other project. It can not creating CAttribute class objects.

янв 22, 2013 5:51:04 PM org.bridj.BridJ log
INFO: No fields found in nativehtmltokenizer.CTokenizer (maybe they weren't declared as public ?)
янв 22, 2013 5:51:04 PM org.bridj.BridJ log
INFO: Environment var LD_LIBRARY_PATH = null
янв 22, 2013 5:51:04 PM org.bridj.BridJ log
INFO: Environment var DYLD_LIBRARY_PATH = null
янв 22, 2013 5:51:04 PM org.bridj.BridJ log
INFO: Environment var PATH = C:\Program Files (x86)\AMD APP\bin\x86_64;C:\Program Files (x86)\AMD APP\bin\x86;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\ATI Technologies\ATI.ACE\Core-Static;C:\Program Files (x86)\Microsoft SQL Server\100\Tools\Binn\;C:\Program Files\Microsoft SQL Server\100\Tools\Binn\;C:\Program Files\Microsoft SQL Server\100\DTS\Binn\;C:\Program Files\TortoiseSVN\bin;C:\Program Files (x86)\Visual Leak Detector\bin\Win32;C:\Program Files (x86)\Visual Leak Detector\bin\Win64;C:\Program Files (x86)\Microsoft ASP.NET\ASP.NET Web Pages\v1.0\;C:\Program Files\Microsoft SQL Server\110\Tools\Binn\;C:\Program Files (x86)\Java\jdk1.7.0_09\bin;C:\Program Files\Microsoft\Web Platform Installer\;C:\Program Files (x86)\Windows Kits\8.0\Windows Performance Toolkit\
янв 22, 2013 5:51:04 PM org.bridj.BridJ log
INFO: Property java.library.path = C:\Program Files (x86)\Java\jdk1.7.0_09\bin;C:\Windows\Sun\Java\bin;C:\Windows\system32;C:\Windows;C:\Program Files (x86)\AMD APP\bin\x86_64;C:\Program Files (x86)\AMD APP\bin\x86;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\ATI Technologies\ATI.ACE\Core-Static;C:\Program Files (x86)\Microsoft SQL Server\100\Tools\Binn\;C:\Program Files\Microsoft SQL Server\100\Tools\Binn\;C:\Program Files\Microsoft SQL Server\100\DTS\Binn\;C:\Program Files\TortoiseSVN\bin;C:\Program Files (x86)\Visual Leak Detector\bin\Win32;C:\Program Files (x86)\Visual Leak Detector\bin\Win64;C:\Program Files (x86)\Microsoft ASP.NET\ASP.NET Web Pages\v1.0\;C:\Program Files\Microsoft SQL Server\110\Tools\Binn\;C:\Program Files (x86)\Java\jdk1.7.0_09\bin;C:\Program Files\Microsoft\Web Platform Installer\;C:\Program Files (x86)\Windows Kits\8.0\Windows Performance Toolkit\;.
янв 22, 2013 5:51:04 PM org.bridj.BridJ log
INFO: Property gnu.classpath.boot.library.path = null
янв 22, 2013 5:51:04 PM org.bridj.BridJ log
INFO: Loaded library 'JavaTokenizerDLL' from 'D:\Java\NativeHTMLTokenizer\JavaTokenizerDLL.dll'
янв 22, 2013 5:51:04 PM org.bridj.BridJ log
INFO: Symbol parsing failed : Reached end of string '?GetState@CTokenizer@Parser@@QBE?AW4EState@2@XZ' (in symbol '?GetState@CTokenizer@Parser@@QBE?AW4EState@2@XZ')
янв 22, 2013 5:51:05 PM org.bridj.BridJ log
INFO: No fields found in org.bridj.cpp.CPPRuntime$CPPDestructor (maybe they weren't declared as public ?)
янв 22, 2013 5:51:05 PM org.bridj.BridJ log
INFO: No fields found in org.bridj.cpp.CPPRuntime_CPPDestructor_NativeImpl (maybe they weren't declared as public ?)
янв 22, 2013 5:51:05 PM org.bridj.BridJ log
INFO: No fields found in org.bridj.dyncallbacks.PointerToVoid_0 (maybe they weren't declared as public ?)
янв 22, 2013 5:51:20 PM org.bridj.BridJ log
INFO: No fields found in nativehtmltokenizer.CToken (maybe they weren't declared as public ?)
янв 22, 2013 5:51:20 PM org.bridj.BridJ log
INFO: Symbol parsing failed : Reached end of string '?GetType@CToken@HTML@@UBE?AW4ETokenType@2@XZ' (in symbol '?GetType@CToken@HTML@@UBE?AW4ETokenType@2@XZ')
янв 22, 2013 5:51:20 PM org.bridj.BridJ log
INFO: Failed to find a vtable for type nativehtmltokenizer.CToken
_name = 
_tokenType = 6
янв 22, 2013 5:51:40 PM org.bridj.BridJ log
INFO: No fields found in nativehtmltokenizer.CStdToken (maybe they weren't declared as public ?)
янв 22, 2013 5:51:40 PM org.bridj.BridJ log
INFO: Symbol parsing failed : Reached end of string '?GetAttribute@CStdToken@HTML@@QBEPAVCAttribute@2@I@Z' (in symbol '?GetAttribute@CStdToken@HTML@@QBEPAVCAttribute@2@I@Z')
_name = 
value = ⋚︀
attributes count = 0
Java Result: -1073740940
СБОРКА УСПЕШНО ЗАВЕРШЕНА (общее время: 1 минута 9 секунды)

And it say "Failed to find a vtable for type nativehtmltokenizer.CToken", but CToken have VTable! I'm try not using AToken, I thought it is solve this problem, but nothing has changed.

CPP AToken:

class EXPORT AToken
{
protected:
    AToken() { /* empty */ }
public:
    virtual ~AToken() { /* empty */ }

    virtual ETokenType GetType() const = 0;
};

Java AToken:

@Library("JavaTokenizerDLL") 
@Runtime(CPPRuntime.class) 
public class AToken extends CPPObject {
        static {
            BridJ.register();
        }

        public AToken() {
                super();
        }

        public AToken(Pointer pointer) {
                super(pointer);
        }

        //@Virtual(0)
       //public native void ATokenDestructor();

        //@Virtual(1)
        native public ETokenType GetType();
};

CPP CToken:

class EXPORT CToken : public AToken
{
public:
    CToken();
    ~CToken() override;

    virtual ETokenType GetType() const final;

    void SetName(const DString& name);
    DString GetName() const;

    void AppendToName(wchar_t character);
    void AppendToName(const DString& str);

#ifdef EXPORT_IN_JAVA
    void jSetName(const wchar_t* name);
    const wchar_t* jGetName() const;

    void jAppendToName(const wchar_t* str);
#endif

protected:
    DString mName;
    ETokenType mType;
};

Java CToken:

@Library("JavaTokenizerDLL")
@Runtime(CPPRuntime.class) 
public class CToken extends CPPObject {
        static {
            BridJ.register();
        }

    public CToken() {
        super();
    }
        public CToken(Pointer pointer) {
        super(pointer);
    }

        //@Virtual(0) // TODO
        //public native void CTokenDestructor();

        @Virtual(1) // TODO
        //@Override
    native public ETokenType GetType();

        native public void jSetName(Pointer<Character > name);
    native public Pointer<Character > jGetName();

    native public void AppendToName(char character);
    native public void jAppendToName(Pointer<Character > str);
}

What I do not correct?
In MSVC project settings optimization is off.

@DarkKnight178

This comment has been minimized.

Show comment
Hide comment
@DarkKnight178

DarkKnight178 commented Jan 24, 2013

Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment