1. wxTaskBarIcon help
- Posted by ghaberek (admin) Feb 18, 2009
- 1254 views
Matt,
I'm trying to wrap wxTaskBarIcon, and I'm doing something wrong. I just committed wxTaskBarIcon.cpp. When I try to build the library, I get the following error. I'm not sure what I'm doing wrong.
Open Watcom Make Version 1.7 Portions Copyright (c) 1988-2002 Sybase, Inc. All Rights Reserved. Source code is available under the Sybase Open Watcom Public License. See http://www.openwatcom.org/ for details. wpp386 -bt=nt -zq -fo=wat_dll\wxTaskBarIcon.obj /bd /xs -d__WXMSW__ -dwxNO_THREADS -dWXEUMSW -d_UNICODE -i=C:\EUPHORIA\wxWidgets-2.8.7\lib\wat_dll\mswu -DWX_LIB_BUILD=13 -i=C:\EUPHORIA\wxWidgets-2.8.7\include -w0 -dWXUSINGDLL -i=C:\EUPHORIA\wxWidgets-2.8.7\lib\wat_dll\mswu /d1 -dNOPCH .\wxTaskBarIcon.cpp wlink runtime windows=4.0 @wat_dll\wxeu.lbc @wat_dll\exports.lbc Error! E2028: near wxString::wxString( int ) is an undefined reference file wat_dll\wxTaskBarIcon.obj(C:\EUPHORIA\wxEuphoria\wxeu\trunk\wxTaskBarIcon.cpp): undefined symbol near wxString::wxString( int )
Here's the code:
// For compilers that support precompilation, includes "wx/wx.h". #include "wx/wxprec.h" #ifdef __BORLANDC__ #pragma hdrstop #endif #ifndef WX_PRECOMP #include "wx/wx.h" #endif #include "alldefs.h" #include "wxeu.h" #include "wx/taskbar.h" extern "C"{ class EuTaskBarIcon: public wxTaskBarIcon { public: EuTaskBarIcon() {} wxMenu * m_Menu; virtual wxMenu *CreatePopupMenu(); }; wxMenu *EuTaskBarIcon::CreatePopupMenu() { m_Menu = new wxMenu; return m_Menu; } object WXEUAPI new_wxTaskBarIcon(object params) { wxDeRefDS( params ); EuTaskBarIcon * icon = new EuTaskBarIcon(); return BOX_INT( icon ); } object WXEUAPI get_taskbar_menu( int taskbar ) { return BOX_INT( ((EuTaskBarIcon*)taskbar)->m_Menu ); } void WXEUAPI set_taskbar_icon( int taskbar, int icon, object tooltip ) { wxIcon ico = (wxIcon)icon; wxString str = get_string(tooltip); wxDeRefDS( tooltip ); ((EuTaskBarIcon*)taskbar)->SetIcon( ico, str ); } }
-Greg
2. Re: wxTaskBarIcon help
- Posted by mattlewis (admin) Feb 18, 2009
- 1112 views
I'm trying to wrap wxTaskBarIcon, and I'm doing something wrong. I just committed wxTaskBarIcon.cpp. When I try to build the library, I get the following error. I'm not sure what I'm doing wrong.
Stupid pointer tricks:
wxIcon ico = (wxIcon)icon; ...should be... wxIcon ico = *(wxIcon*)icon;The int icon parameter is really a pointer, but since you need to pass a reference, you can dereference it like that. You could alternatively do this:
wxIcon* ico = (wxIcon*)icon; ... ((EuTaskBarIcon*)taskbar)->SetIcon( *ico, str );I think the weird error was probably due to the compiler trying too hard to construct a wxIcon object from an int.
Also, how are you generating the exports? It's always missing some:
Failed to link function: +get_staticbitmap Failed to link procedure: +set_mdi_child_title Failed to link procedure: +set_staticbitmap Failed to link variable: null_pen Failed to link variable: null_brushI committed r371 fixing wxTaskBarIcon.cpp and the exports.
Matt
3. Re: wxTaskBarIcon help
- Posted by ghaberek (admin) Feb 18, 2009
- 1156 views
Stupid pointer tricks:
wxIcon ico = (wxIcon)icon; ...should be... wxIcon ico = *(wxIcon*)icon;The int icon parameter is really a pointer, but since you need to pass a reference, you can dereference it like that. You could alternatively do this:
wxIcon* ico = (wxIcon*)icon; ... ((EuTaskBarIcon*)taskbar)->SetIcon( *ico, str );I think the weird error was probably due to the compiler trying too hard to construct a wxIcon object from an int.
Figures. This is why I hate pointers (and therefore dislike C as a whole).
Also, how are you generating the exports? It's always missing some:
Failed to link function: +get_staticbitmap Failed to link procedure: +set_mdi_child_title Failed to link procedure: +set_staticbitmap Failed to link variable: null_pen Failed to link variable: null_brushI committed r371 fixing wxTaskBarIcon.cpp and the exports.
See export.exw. It uses the same methods as wrap.exw to fish out all the routines and dump them into wat_dll\exports.lbc. So they're in exports.lbc, but they're not showing up in the final dll, for some reason. I just updated export.exw to output null_pen and null_brush, but they're still not showing up. And with the recent addition of wxTaskBarIcon.cpp, the list gets longer:
Failed to link function: +get_staticbitmap Failed to link procedure: +set_mdi_child_title Failed to link procedure: +set_staticbitmap Failed to link function: +new_wxTaskBarIcon Failed to link function: +get_taskbar_menu Failed to link procedure: +set_taskbar_icon Failed to link variable: null_pen Failed to link variable: null_brushI just committed r372 with my changes to export.exw. Still broken.
-Greg
4. Re: wxTaskBarIcon help
- Posted by mattlewis (admin) Feb 18, 2009
- 1138 views
See export.exw. It uses the same methods as wrap.exw to fish out all the routines and dump them into wat_dll\exports.lbc. So they're in exports.lbc, but they're not showing up in the final dll, for some reason. I just updated export.exw to output null_pen and null_brush, but they're still not showing up. And with the recent addition of wxTaskBarIcon.cpp, the list gets longer:
Failed to link function: +get_staticbitmap Failed to link procedure: +set_mdi_child_title Failed to link procedure: +set_staticbitmap Failed to link function: +new_wxTaskBarIcon Failed to link function: +get_taskbar_menu Failed to link procedure: +set_taskbar_icon Failed to link variable: null_pen Failed to link variable: null_brush
Ok, the problem is that the regex is looking for an open paren immediately after the name. The functions and procedures have a space before the paren, and the variables, of course, don't have parenthesis at all.
I think the export generation should look at wxeud.e (which is what the makefile does), since it provides a double check, and ensures that everything that it wants to see is actually exported. Omitting an export 'silently' fails until wxEuphoria tries to use it, while exporting something that hasn't been compiled causes a linker error. From makefile.wat:
grep -hP "=\s+wx_define_c_" wxeud.e | sed -re "s/.*\"(.*)\".*/EXPORT \1=_\1/" > wat_dll\exports.lbcThe first regex finds the lines, and the second one generates the line in exports.lbc. Sheesh, just install gnuwin32 already.
Matt
5. Re: wxTaskBarIcon help
- Posted by ghaberek (admin) Feb 18, 2009
- 1205 views
Ok, the problem is that the regex is looking for an open paren immediately after the name. The functions and procedures have a space before the paren, and the variables, of course, don't have parenthesis at all.
I think the export generation should look at wxeud.e (which is what the makefile does), since it provides a double check, and ensures that everything that it wants to see is actually exported. Omitting an export 'silently' fails until wxEuphoria tries to use it, while exporting something that hasn't been compiled causes a linker error. From makefile.wat:
grep -hP "=\s+wx_define_c_" wxeud.e | sed -re "s/.*\"(.*)\".*/EXPORT \1=_\1/" > wat_dll\exports.lbcThe first regex finds the lines, and the second one generates the line in exports.lbc. Sheesh, just install gnuwin32 already.
Cool. I kept seeing you mention grep/sed for generating exports, but I never knew what that was all about. I'll install GnuWin32. It's probably for the best anyway. I'm sick of trying to "figure it out" with the Windows utilities like type and find.
-Greg
6. Re: wxTaskBarIcon help
- Posted by ghaberek (admin) Feb 18, 2009
- 1116 views
Hrm... GunWin32 didn't seem to install grep. But this works equally as well:
type wxeud.e | find "= wx_define_c_" | sed -re "s/.*\"(.*)\".*/EXPORT \1=_\1/" > exports.lbc
-Greg
7. Re: wxTaskBarIcon help
- Posted by ghaberek (admin) Feb 18, 2009
- 1053 views
Okay... now all the exports are fixed.
8. Re: wxTaskBarIcon help
- Posted by mattlewis (admin) Feb 18, 2009
- 1151 views
Hrm... GunWin32 didn't seem to install grep. But this works equally as well:
type wxeud.e | find "= wx_define_c_" | sed -re "s/.*\"(.*)\".*/EXPORT \1=_\1/" > exports.lbc
Somehow that just seems dirty.
Which packages did you install? Grep has its own package.
Matt
9. Re: wxTaskBarIcon help
- Posted by ghaberek (admin) Feb 18, 2009
- 1137 views
Somehow that just seems dirty.
It is. Cheap and dirty all the way.
Which packages did you install? Grep has its own package.
I downloaded the gnuwin32 package maintenance utility. It's where the "Download All" link took me.
-Greg
10. Re: wxTaskBarIcon help
- Posted by Bellthorpe Mar 10, 2009
- 1161 views
- Last edited Mar 11, 2009
Cool. I kept seeing you mention grep/sed for generating exports, but I never knew what that was all about. I'll install GnuWin32. It's probably for the best anyway. I'm sick of trying to "figure it out" with the Windows utilities like type and find.
Or you could try the package I recommended to Matt in 2007 this post.