I dove into the source code and saw that in CGUIEditBox.h and CGUIEditBox.cpp, there's a "s32 CursorPos" variable that seems to be the raw location, and the method "CGUIEditBox::getLineFromPos(s32 Pos)" which seems to decompose that into a line number.
However, getLineFromPos() and CursorPos are both protected, and there are no public getters/setters for the CursorPos, so I cannot use the irrlicht classes straight up.
My Idea is to subclass the CGUIEditBox class, and write new public functions to expose the inherited function/variable that I need. However, when I do this, I get linking errors saying that it can't find CGUIEditBox's constructor. I'm linking to the DLL's .a file, and I just built it fresh a second ago. I'm using codeblocks for everything. Oh, there's more errors: a "undefined reference to X" for every member of CGUIEditBox.
Am I even approaching this right? The real object code is stored in the dll file, and trying to link subclasses to the exported definitions .a file. Except, the linker can't find any of the variables or functions.
here's the first error:
Code: Select all
||=== Build: Debug in VMG Screen Demo (compiler: GNU GCC Compiler) ===|
obj\Debug\GUIStatEditBox.o||In function `ZN14GUIStatEditBoxC2EPN3irr3gui15IGUIEnvironmentEPNS1_11IGUIElementEiNS0_4core4rectIiEE':|
D:\work\code\vmg_screen\GUIStatEditBox.cpp|13|undefined reference to `irr::gui::CGUIEditBox::CGUIEditBox(wchar_t const*, bool, irr::gui::IGUIEnvironment*, irr::gui::IGUIElement*, int, irr::core::rect<int> const&)'
Code: Select all
mingw32-g++.exe -Wall -fexceptions -g -IC:\irrlicht-1.8\include -ID:\work\code\vmg_screen\ -IC:\irrlicht-1.8\source\Irrlicht -c D:\work\code\vmg_screen\GUIStatEditBox.cpp -o obj\Debug\GUIStatEditBox.o
mingw32-g++.exe -LC:\irrlicht-1.8\lib\Win32-gcc -o bin\Debug\Irrlight_GRTT.exe obj\Debug\GUIStatEditBox.o C:\irrlicht-1.8\lib\Win32-gcc\libIrrlicht.a
obj\Debug\GUIStatEditBox.o: In function `ZN14GUIStatEditBoxC2EPN3irr3gui15IGUIEnvironmentEPNS1_11IGUIElementEiNS0_4core4rectIiEE':
D:/work/code/vmg_screen/GUIStatEditBox.cpp:13: undefined reference to `irr::gui::CGUIEditBox::CGUIEditBox(wchar_t const*, bool, irr::gui::IGUIEnvironment*, irr::gui::IGUIElement*, int, irr::core::rect<int> const&)'
obj\Debug\GUIStatEditBox.o: In function `ZN14GUIStatEditBoxC1EPN3irr3gui15IGUIEnvironmentEPNS1_11IGUIElementEiNS0_4core4rectIiEE':
D:/work/code/vmg_screen/GUIStatEditBox.cpp:13: undefined reference to `irr::gui::CGUIEditBox::CGUIEditBox(wchar_t const*, bool, irr::gui::IGUIEnvironment*, irr::gui::IGUIElement*, int, irr::core::rect<int> const&)'
Code: Select all
#include "irrlicht.h"
#include "CGUIEditBox.h"
using namespace irr;
using namespace gui;
class GUIStatEditBox:public CGUIEditBox
{
public:
GUIStatEditBox(IGUIEnvironment* environment, IGUIElement* parent, s32 id, core::rect<s32> rectangle);
s32 getCursorLine();
protected:
private:
};
Code: Select all
#include <irrlicht.h>
#include <GUIStatEditBox.h>
GUIStatEditBox::GUIStatEditBox(IGUIEnvironment* environment, IGUIElement* parent, s32 id, core::rect<s32> rectangle)
:CGUIEditBox(L"initText", false, environment, parent, id, rectangle)
{
}
EDIT:
I ran nm on the dll that I built using codeblocks in the irrlicht debug dll mode and I can see the CGUIEditBox constructor is exposed in the dll.
I'm linking to the LibIrrlicht.a file, which is generated at the same time as the DLL because I think it's the import library. When I look at the import library using NM, and the .def file using a text editor, it looks like none of the .dll funcions are exported except for "create device".
FINAL EDIT BEFORE BEDTIME:
I'm trying to subclass an irrlicht class in my user project which links to the irrlicht dll. I think this method is destined to fail, since the import library doesn't expose constructors for the classes. Tomorrow I'm just going to add my special class to irrlicht, then compile a special modified .dll and use that.