extracted Unix code in a separate new file (src/unix/dlunix.cpp), it remains only to refactor Mac/OS2 versions to finally fix the mess in common/dnylib.cpp...

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@31405 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin 2005-01-16 22:21:44 +00:00
parent 114a4501f8
commit da55d0644f
6 changed files with 488 additions and 249 deletions

View File

@ -399,6 +399,7 @@ ALL_BASE_SOURCES = \
src/common/zstream.cpp \
src/unix/baseunix.cpp \
src/unix/dir.cpp \
src/unix/dlunix.cpp \
src/unix/mimetype.cpp \
src/unix/snglinst.cpp \
src/unix/stdpaths.cpp \
@ -2069,12 +2070,16 @@ COND_TOOLKIT_MAC_ADVANCED_PLATFORM_HDR = \
@COND_TOOLKIT_MOTIF@ADVANCED_PLATFORM_HDR = \
@COND_TOOLKIT_MOTIF@ wx/unix/joystick.h wx/unix/sound.h \
@COND_TOOLKIT_MOTIF@ wx/unix/taskbarx11.h
@COND_TOOLKIT_MSW@ADVANCED_PLATFORM_HDR = wx/msw/sound.h \
@COND_TOOLKIT_MSW@ wx/msw/taskbar.h wx/msw/joystick.h
COND_TOOLKIT_MSW_ADVANCED_PLATFORM_HDR = \
wx/msw/datectrl.h \
wx/msw/sound.h \
wx/msw/taskbar.h \
wx/msw/joystick.h
@COND_TOOLKIT_MSW@ADVANCED_PLATFORM_HDR = $(COND_TOOLKIT_MSW_ADVANCED_PLATFORM_HDR)
@COND_TOOLKIT_PM@ADVANCED_PLATFORM_HDR = wx/os2/joystick.h \
@COND_TOOLKIT_PM@ wx/os2/sound.h
@COND_TOOLKIT_WINCE@ADVANCED_PLATFORM_HDR = \
@COND_TOOLKIT_WINCE@ wx/msw/sound.h wx/msw/taskbar.h
@COND_TOOLKIT_WINCE@ wx/msw/datectrl.h wx/msw/sound.h wx/msw/taskbar.h
@COND_TOOLKIT_X11@ADVANCED_PLATFORM_HDR = \
@COND_TOOLKIT_X11@ wx/unix/joystick.h wx/unix/sound.h wx/unix/taskbarx11.h
@COND_TOOLKIT_COCOA@MEDIA_PLATFORM_HDR =
@ -2306,6 +2311,8 @@ COND_USE_GUI_1_ALL_GUI_HEADERS = \
$(LOWLEVEL_HDR) \
$(GUI_CORE_HEADERS) \
wx/calctrl.h \
wx/dateevt.h \
wx/datectrl.h \
wx/dcbuffer.h \
wx/generic/calctrl.h \
wx/generic/grid.h \
@ -2461,6 +2468,7 @@ COND_PLATFORM_OS2_1___BASE_PLATFORM_SRC_OBJECTS = \
COND_PLATFORM_UNIX_1___BASE_PLATFORM_SRC_OBJECTS = \
monodll_baseunix.o \
monodll_dir.o \
monodll_dlunix.o \
monodll_mimetype.o \
monodll_snglinst.o \
monodll_stdpaths.o \
@ -2485,6 +2493,7 @@ COND_PLATFORM_WIN32_1___BASE_PLATFORM_SRC_OBJECTS = \
COND_TOOLKIT____BASE_MACOSX_SRC_OBJECTS = \
monodll_baseunix.o \
monodll_dir.o \
monodll_dlunix.o \
monodll_mimetype.o \
monodll_snglinst.o \
monodll_stdpaths.o \
@ -2495,6 +2504,7 @@ COND_TOOLKIT____BASE_MACOSX_SRC_OBJECTS = \
COND_TOOLKIT_COCOA___BASE_MACOSX_SRC_OBJECTS = \
monodll_baseunix.o \
monodll_dir.o \
monodll_dlunix.o \
monodll_mimetype.o \
monodll_snglinst.o \
monodll_stdpaths.o \
@ -2505,6 +2515,7 @@ COND_TOOLKIT_COCOA___BASE_MACOSX_SRC_OBJECTS = \
COND_TOOLKIT_GTK___BASE_MACOSX_SRC_OBJECTS = \
monodll_baseunix.o \
monodll_dir.o \
monodll_dlunix.o \
monodll_mimetype.o \
monodll_snglinst.o \
monodll_stdpaths.o \
@ -2522,11 +2533,13 @@ COND_TOOLKIT_MAC___BASE_MACOSX_SRC_OBJECTS = \
monodll_cfstring.o \
monodll_stdpaths_cf.o \
monodll_baseunix.o \
monodll_dlunix.o \
monodll_stdpaths.o
@COND_TOOLKIT_MAC@__BASE_MACOSX_SRC_OBJECTS = $(COND_TOOLKIT_MAC___BASE_MACOSX_SRC_OBJECTS)
COND_TOOLKIT_MOTIF___BASE_MACOSX_SRC_OBJECTS = \
monodll_baseunix.o \
monodll_dir.o \
monodll_dlunix.o \
monodll_mimetype.o \
monodll_snglinst.o \
monodll_stdpaths.o \
@ -2537,6 +2550,7 @@ COND_TOOLKIT_MOTIF___BASE_MACOSX_SRC_OBJECTS = \
COND_TOOLKIT_X11___BASE_MACOSX_SRC_OBJECTS = \
monodll_baseunix.o \
monodll_dir.o \
monodll_dlunix.o \
monodll_mimetype.o \
monodll_snglinst.o \
monodll_stdpaths.o \
@ -3836,13 +3850,18 @@ COND_TOOLKIT_MOTIF___ADVANCED_PLATFORM_SRC_OBJECTS = \
monodll_sound.o \
monodll_taskbarx11.o
@COND_TOOLKIT_MOTIF@__ADVANCED_PLATFORM_SRC_OBJECTS = $(COND_TOOLKIT_MOTIF___ADVANCED_PLATFORM_SRC_OBJECTS)
@COND_TOOLKIT_MSW@__ADVANCED_PLATFORM_SRC_OBJECTS = \
@COND_TOOLKIT_MSW@ monodll_taskbarcmn.o monodll_sound.o monodll_taskbar.o \
@COND_TOOLKIT_MSW@ monodll_joystick.o
COND_TOOLKIT_MSW___ADVANCED_PLATFORM_SRC_OBJECTS = \
monodll_taskbarcmn.o \
monodll_datectrl.o \
monodll_sound.o \
monodll_taskbar.o \
monodll_joystick.o
@COND_TOOLKIT_MSW@__ADVANCED_PLATFORM_SRC_OBJECTS = $(COND_TOOLKIT_MSW___ADVANCED_PLATFORM_SRC_OBJECTS)
@COND_TOOLKIT_PM@__ADVANCED_PLATFORM_SRC_OBJECTS = \
@COND_TOOLKIT_PM@ monodll_joystick.o monodll_sound.o
@COND_TOOLKIT_WINCE@__ADVANCED_PLATFORM_SRC_OBJECTS = \
@COND_TOOLKIT_WINCE@ monodll_taskbarcmn.o monodll_sound.o monodll_taskbar.o
@COND_TOOLKIT_WINCE@ monodll_taskbarcmn.o monodll_datectrl.o \
@COND_TOOLKIT_WINCE@ monodll_sound.o monodll_taskbar.o
COND_TOOLKIT_X11___ADVANCED_PLATFORM_SRC_OBJECTS = \
monodll_taskbarcmn.o \
monodll_joystick.o \
@ -3901,6 +3920,7 @@ COND_PLATFORM_OS2_1___BASE_PLATFORM_SRC_OBJECTS_1 = \
COND_PLATFORM_UNIX_1___BASE_PLATFORM_SRC_OBJECTS_1 = \
monolib_baseunix.o \
monolib_dir.o \
monolib_dlunix.o \
monolib_mimetype.o \
monolib_snglinst.o \
monolib_stdpaths.o \
@ -3925,6 +3945,7 @@ COND_PLATFORM_WIN32_1___BASE_PLATFORM_SRC_OBJECTS_1 = \
COND_TOOLKIT____BASE_MACOSX_SRC_OBJECTS_1 = \
monolib_baseunix.o \
monolib_dir.o \
monolib_dlunix.o \
monolib_mimetype.o \
monolib_snglinst.o \
monolib_stdpaths.o \
@ -3935,6 +3956,7 @@ COND_TOOLKIT____BASE_MACOSX_SRC_OBJECTS_1 = \
COND_TOOLKIT_COCOA___BASE_MACOSX_SRC_OBJECTS_1 = \
monolib_baseunix.o \
monolib_dir.o \
monolib_dlunix.o \
monolib_mimetype.o \
monolib_snglinst.o \
monolib_stdpaths.o \
@ -3945,6 +3967,7 @@ COND_TOOLKIT_COCOA___BASE_MACOSX_SRC_OBJECTS_1 = \
COND_TOOLKIT_GTK___BASE_MACOSX_SRC_OBJECTS_1 = \
monolib_baseunix.o \
monolib_dir.o \
monolib_dlunix.o \
monolib_mimetype.o \
monolib_snglinst.o \
monolib_stdpaths.o \
@ -3962,11 +3985,13 @@ COND_TOOLKIT_MAC___BASE_MACOSX_SRC_OBJECTS_1 = \
monolib_cfstring.o \
monolib_stdpaths_cf.o \
monolib_baseunix.o \
monolib_dlunix.o \
monolib_stdpaths.o
@COND_TOOLKIT_MAC@__BASE_MACOSX_SRC_OBJECTS_1 = $(COND_TOOLKIT_MAC___BASE_MACOSX_SRC_OBJECTS_1)
COND_TOOLKIT_MOTIF___BASE_MACOSX_SRC_OBJECTS_1 = \
monolib_baseunix.o \
monolib_dir.o \
monolib_dlunix.o \
monolib_mimetype.o \
monolib_snglinst.o \
monolib_stdpaths.o \
@ -3977,6 +4002,7 @@ COND_TOOLKIT_MOTIF___BASE_MACOSX_SRC_OBJECTS_1 = \
COND_TOOLKIT_X11___BASE_MACOSX_SRC_OBJECTS_1 = \
monolib_baseunix.o \
monolib_dir.o \
monolib_dlunix.o \
monolib_mimetype.o \
monolib_snglinst.o \
monolib_stdpaths.o \
@ -5278,13 +5304,18 @@ COND_TOOLKIT_MOTIF___ADVANCED_PLATFORM_SRC_OBJECTS_1 = \
monolib_sound.o \
monolib_taskbarx11.o
@COND_TOOLKIT_MOTIF@__ADVANCED_PLATFORM_SRC_OBJECTS_1 = $(COND_TOOLKIT_MOTIF___ADVANCED_PLATFORM_SRC_OBJECTS_1)
@COND_TOOLKIT_MSW@__ADVANCED_PLATFORM_SRC_OBJECTS_1 = \
@COND_TOOLKIT_MSW@ monolib_taskbarcmn.o monolib_sound.o monolib_taskbar.o \
@COND_TOOLKIT_MSW@ monolib_joystick.o
COND_TOOLKIT_MSW___ADVANCED_PLATFORM_SRC_OBJECTS_1 = \
monolib_taskbarcmn.o \
monolib_datectrl.o \
monolib_sound.o \
monolib_taskbar.o \
monolib_joystick.o
@COND_TOOLKIT_MSW@__ADVANCED_PLATFORM_SRC_OBJECTS_1 = $(COND_TOOLKIT_MSW___ADVANCED_PLATFORM_SRC_OBJECTS_1)
@COND_TOOLKIT_PM@__ADVANCED_PLATFORM_SRC_OBJECTS_1 = \
@COND_TOOLKIT_PM@ monolib_joystick.o monolib_sound.o
@COND_TOOLKIT_WINCE@__ADVANCED_PLATFORM_SRC_OBJECTS_1 = \
@COND_TOOLKIT_WINCE@ monolib_taskbarcmn.o monolib_sound.o monolib_taskbar.o
@COND_TOOLKIT_WINCE@ monolib_taskbarcmn.o monolib_datectrl.o \
@COND_TOOLKIT_WINCE@ monolib_sound.o monolib_taskbar.o
COND_TOOLKIT_X11___ADVANCED_PLATFORM_SRC_OBJECTS_1 = \
monolib_taskbarcmn.o \
monolib_joystick.o \
@ -5378,6 +5409,7 @@ COND_PLATFORM_OS2_1___BASE_PLATFORM_SRC_OBJECTS_2 = \
COND_PLATFORM_UNIX_1___BASE_PLATFORM_SRC_OBJECTS_2 = \
basedll_baseunix.o \
basedll_dir.o \
basedll_dlunix.o \
basedll_mimetype.o \
basedll_snglinst.o \
basedll_stdpaths.o \
@ -5402,6 +5434,7 @@ COND_PLATFORM_WIN32_1___BASE_PLATFORM_SRC_OBJECTS_2 = \
COND_TOOLKIT____BASE_MACOSX_SRC_OBJECTS_2 = \
basedll_baseunix.o \
basedll_dir.o \
basedll_dlunix.o \
basedll_mimetype.o \
basedll_snglinst.o \
basedll_stdpaths.o \
@ -5412,6 +5445,7 @@ COND_TOOLKIT____BASE_MACOSX_SRC_OBJECTS_2 = \
COND_TOOLKIT_COCOA___BASE_MACOSX_SRC_OBJECTS_2 = \
basedll_baseunix.o \
basedll_dir.o \
basedll_dlunix.o \
basedll_mimetype.o \
basedll_snglinst.o \
basedll_stdpaths.o \
@ -5422,6 +5456,7 @@ COND_TOOLKIT_COCOA___BASE_MACOSX_SRC_OBJECTS_2 = \
COND_TOOLKIT_GTK___BASE_MACOSX_SRC_OBJECTS_2 = \
basedll_baseunix.o \
basedll_dir.o \
basedll_dlunix.o \
basedll_mimetype.o \
basedll_snglinst.o \
basedll_stdpaths.o \
@ -5439,11 +5474,13 @@ COND_TOOLKIT_MAC___BASE_MACOSX_SRC_OBJECTS_2 = \
basedll_cfstring.o \
basedll_stdpaths_cf.o \
basedll_baseunix.o \
basedll_dlunix.o \
basedll_stdpaths.o
@COND_TOOLKIT_MAC@__BASE_MACOSX_SRC_OBJECTS_2 = $(COND_TOOLKIT_MAC___BASE_MACOSX_SRC_OBJECTS_2)
COND_TOOLKIT_MOTIF___BASE_MACOSX_SRC_OBJECTS_2 = \
basedll_baseunix.o \
basedll_dir.o \
basedll_dlunix.o \
basedll_mimetype.o \
basedll_snglinst.o \
basedll_stdpaths.o \
@ -5454,6 +5491,7 @@ COND_TOOLKIT_MOTIF___BASE_MACOSX_SRC_OBJECTS_2 = \
COND_TOOLKIT_X11___BASE_MACOSX_SRC_OBJECTS_2 = \
basedll_baseunix.o \
basedll_dir.o \
basedll_dlunix.o \
basedll_mimetype.o \
basedll_snglinst.o \
basedll_stdpaths.o \
@ -5508,6 +5546,7 @@ COND_PLATFORM_OS2_1___BASE_PLATFORM_SRC_OBJECTS_3 = \
COND_PLATFORM_UNIX_1___BASE_PLATFORM_SRC_OBJECTS_3 = \
baselib_baseunix.o \
baselib_dir.o \
baselib_dlunix.o \
baselib_mimetype.o \
baselib_snglinst.o \
baselib_stdpaths.o \
@ -5532,6 +5571,7 @@ COND_PLATFORM_WIN32_1___BASE_PLATFORM_SRC_OBJECTS_3 = \
COND_TOOLKIT____BASE_MACOSX_SRC_OBJECTS_3 = \
baselib_baseunix.o \
baselib_dir.o \
baselib_dlunix.o \
baselib_mimetype.o \
baselib_snglinst.o \
baselib_stdpaths.o \
@ -5542,6 +5582,7 @@ COND_TOOLKIT____BASE_MACOSX_SRC_OBJECTS_3 = \
COND_TOOLKIT_COCOA___BASE_MACOSX_SRC_OBJECTS_3 = \
baselib_baseunix.o \
baselib_dir.o \
baselib_dlunix.o \
baselib_mimetype.o \
baselib_snglinst.o \
baselib_stdpaths.o \
@ -5552,6 +5593,7 @@ COND_TOOLKIT_COCOA___BASE_MACOSX_SRC_OBJECTS_3 = \
COND_TOOLKIT_GTK___BASE_MACOSX_SRC_OBJECTS_3 = \
baselib_baseunix.o \
baselib_dir.o \
baselib_dlunix.o \
baselib_mimetype.o \
baselib_snglinst.o \
baselib_stdpaths.o \
@ -5569,11 +5611,13 @@ COND_TOOLKIT_MAC___BASE_MACOSX_SRC_OBJECTS_3 = \
baselib_cfstring.o \
baselib_stdpaths_cf.o \
baselib_baseunix.o \
baselib_dlunix.o \
baselib_stdpaths.o
@COND_TOOLKIT_MAC@__BASE_MACOSX_SRC_OBJECTS_3 = $(COND_TOOLKIT_MAC___BASE_MACOSX_SRC_OBJECTS_3)
COND_TOOLKIT_MOTIF___BASE_MACOSX_SRC_OBJECTS_3 = \
baselib_baseunix.o \
baselib_dir.o \
baselib_dlunix.o \
baselib_mimetype.o \
baselib_snglinst.o \
baselib_stdpaths.o \
@ -5584,6 +5628,7 @@ COND_TOOLKIT_MOTIF___BASE_MACOSX_SRC_OBJECTS_3 = \
COND_TOOLKIT_X11___BASE_MACOSX_SRC_OBJECTS_3 = \
baselib_baseunix.o \
baselib_dir.o \
baselib_dlunix.o \
baselib_mimetype.o \
baselib_snglinst.o \
baselib_stdpaths.o \
@ -8144,13 +8189,18 @@ COND_TOOLKIT_MAC___ADVANCED_PLATFORM_SRC_OBJECTS_2 = \
@COND_TOOLKIT_MOTIF@__ADVANCED_PLATFORM_SRC_OBJECTS_2 = \
@COND_TOOLKIT_MOTIF@ advdll_taskbarcmn.o advdll_joystick.o advdll_sound.o \
@COND_TOOLKIT_MOTIF@ advdll_taskbarx11.o
@COND_TOOLKIT_MSW@__ADVANCED_PLATFORM_SRC_OBJECTS_2 = \
@COND_TOOLKIT_MSW@ advdll_taskbarcmn.o advdll_sound.o advdll_taskbar.o \
@COND_TOOLKIT_MSW@ advdll_joystick.o
COND_TOOLKIT_MSW___ADVANCED_PLATFORM_SRC_OBJECTS_2 = \
advdll_taskbarcmn.o \
advdll_datectrl.o \
advdll_sound.o \
advdll_taskbar.o \
advdll_joystick.o
@COND_TOOLKIT_MSW@__ADVANCED_PLATFORM_SRC_OBJECTS_2 = $(COND_TOOLKIT_MSW___ADVANCED_PLATFORM_SRC_OBJECTS_2)
@COND_TOOLKIT_PM@__ADVANCED_PLATFORM_SRC_OBJECTS_2 = \
@COND_TOOLKIT_PM@ advdll_joystick.o advdll_sound.o
@COND_TOOLKIT_WINCE@__ADVANCED_PLATFORM_SRC_OBJECTS_2 = \
@COND_TOOLKIT_WINCE@ advdll_taskbarcmn.o advdll_sound.o advdll_taskbar.o
@COND_TOOLKIT_WINCE@ advdll_taskbarcmn.o advdll_datectrl.o advdll_sound.o \
@COND_TOOLKIT_WINCE@ advdll_taskbar.o
@COND_TOOLKIT_X11@__ADVANCED_PLATFORM_SRC_OBJECTS_2 = \
@COND_TOOLKIT_X11@ advdll_taskbarcmn.o advdll_joystick.o advdll_sound.o \
@COND_TOOLKIT_X11@ advdll_taskbarx11.o
@ -8184,13 +8234,18 @@ COND_TOOLKIT_MAC___ADVANCED_PLATFORM_SRC_OBJECTS_3 = \
@COND_TOOLKIT_MOTIF@__ADVANCED_PLATFORM_SRC_OBJECTS_3 = \
@COND_TOOLKIT_MOTIF@ advlib_taskbarcmn.o advlib_joystick.o advlib_sound.o \
@COND_TOOLKIT_MOTIF@ advlib_taskbarx11.o
@COND_TOOLKIT_MSW@__ADVANCED_PLATFORM_SRC_OBJECTS_3 = \
@COND_TOOLKIT_MSW@ advlib_taskbarcmn.o advlib_sound.o advlib_taskbar.o \
@COND_TOOLKIT_MSW@ advlib_joystick.o
COND_TOOLKIT_MSW___ADVANCED_PLATFORM_SRC_OBJECTS_3 = \
advlib_taskbarcmn.o \
advlib_datectrl.o \
advlib_sound.o \
advlib_taskbar.o \
advlib_joystick.o
@COND_TOOLKIT_MSW@__ADVANCED_PLATFORM_SRC_OBJECTS_3 = $(COND_TOOLKIT_MSW___ADVANCED_PLATFORM_SRC_OBJECTS_3)
@COND_TOOLKIT_PM@__ADVANCED_PLATFORM_SRC_OBJECTS_3 = \
@COND_TOOLKIT_PM@ advlib_joystick.o advlib_sound.o
@COND_TOOLKIT_WINCE@__ADVANCED_PLATFORM_SRC_OBJECTS_3 = \
@COND_TOOLKIT_WINCE@ advlib_taskbarcmn.o advlib_sound.o advlib_taskbar.o
@COND_TOOLKIT_WINCE@ advlib_taskbarcmn.o advlib_datectrl.o advlib_sound.o \
@COND_TOOLKIT_WINCE@ advlib_taskbar.o
@COND_TOOLKIT_X11@__ADVANCED_PLATFORM_SRC_OBJECTS_3 = \
@COND_TOOLKIT_X11@ advlib_taskbarcmn.o advlib_joystick.o advlib_sound.o \
@COND_TOOLKIT_X11@ advlib_taskbarx11.o
@ -10323,6 +10378,27 @@ monodll_gprint.o: $(srcdir)/src/gtk/gnome/gprint.cpp $(MONODLL_ODEP)
@COND_PLATFORM_OS2_1@monodll_dir.o: $(srcdir)/src/os2/dir.cpp $(MONODLL_ODEP)
@COND_PLATFORM_OS2_1@ $(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $<
@COND_PLATFORM_UNIX_1@monodll_dlunix.o: $(srcdir)/src/unix/dlunix.cpp $(MONODLL_ODEP)
@COND_PLATFORM_UNIX_1@ $(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $<
@COND_PLATFORM_MACOSX_1_TOOLKIT_MAC@monodll_dlunix.o: $(srcdir)/src/unix/dlunix.cpp $(MONODLL_ODEP)
@COND_PLATFORM_MACOSX_1_TOOLKIT_MAC@ $(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $<
@COND_PLATFORM_MACOSX_1_TOOLKIT_COCOA@monodll_dlunix.o: $(srcdir)/src/unix/dlunix.cpp $(MONODLL_ODEP)
@COND_PLATFORM_MACOSX_1_TOOLKIT_COCOA@ $(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $<
@COND_PLATFORM_MACOSX_1_TOOLKIT_GTK@monodll_dlunix.o: $(srcdir)/src/unix/dlunix.cpp $(MONODLL_ODEP)
@COND_PLATFORM_MACOSX_1_TOOLKIT_GTK@ $(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $<
@COND_PLATFORM_MACOSX_1_TOOLKIT_X11@monodll_dlunix.o: $(srcdir)/src/unix/dlunix.cpp $(MONODLL_ODEP)
@COND_PLATFORM_MACOSX_1_TOOLKIT_X11@ $(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $<
@COND_PLATFORM_MACOSX_1_TOOLKIT_MOTIF@monodll_dlunix.o: $(srcdir)/src/unix/dlunix.cpp $(MONODLL_ODEP)
@COND_PLATFORM_MACOSX_1_TOOLKIT_MOTIF@ $(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $<
@COND_PLATFORM_MACOSX_1_TOOLKIT_@monodll_dlunix.o: $(srcdir)/src/unix/dlunix.cpp $(MONODLL_ODEP)
@COND_PLATFORM_MACOSX_1_TOOLKIT_@ $(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $<
@COND_PLATFORM_UNIX_1@monodll_mimetype.o: $(srcdir)/src/unix/mimetype.cpp $(MONODLL_ODEP)
@COND_PLATFORM_UNIX_1@ $(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $<
@ -12873,6 +12949,12 @@ monodll_gprint.o: $(srcdir)/src/gtk/gnome/gprint.cpp $(MONODLL_ODEP)
@COND_TOOLKIT_X11_USE_GUI_1@monodll_taskbarcmn.o: $(srcdir)/src/common/taskbarcmn.cpp $(MONODLL_ODEP)
@COND_TOOLKIT_X11_USE_GUI_1@ $(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $<
@COND_TOOLKIT_MSW_USE_GUI_1@monodll_datectrl.o: $(srcdir)/src/msw/datectrl.cpp $(MONODLL_ODEP)
@COND_TOOLKIT_MSW_USE_GUI_1@ $(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $<
@COND_TOOLKIT_WINCE_USE_GUI_1@monodll_datectrl.o: $(srcdir)/src/msw/datectrl.cpp $(MONODLL_ODEP)
@COND_TOOLKIT_WINCE_USE_GUI_1@ $(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $<
@COND_TOOLKIT_MSW_USE_GUI_1@monodll_taskbar.o: $(srcdir)/src/msw/taskbar.cpp $(MONODLL_ODEP)
@COND_TOOLKIT_MSW_USE_GUI_1@ $(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $<
@ -13650,6 +13732,27 @@ monolib_gprint.o: $(srcdir)/src/gtk/gnome/gprint.cpp $(MONOLIB_ODEP)
@COND_PLATFORM_OS2_1@monolib_dir.o: $(srcdir)/src/os2/dir.cpp $(MONOLIB_ODEP)
@COND_PLATFORM_OS2_1@ $(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $<
@COND_PLATFORM_UNIX_1@monolib_dlunix.o: $(srcdir)/src/unix/dlunix.cpp $(MONOLIB_ODEP)
@COND_PLATFORM_UNIX_1@ $(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $<
@COND_PLATFORM_MACOSX_1_TOOLKIT_MAC@monolib_dlunix.o: $(srcdir)/src/unix/dlunix.cpp $(MONOLIB_ODEP)
@COND_PLATFORM_MACOSX_1_TOOLKIT_MAC@ $(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $<
@COND_PLATFORM_MACOSX_1_TOOLKIT_COCOA@monolib_dlunix.o: $(srcdir)/src/unix/dlunix.cpp $(MONOLIB_ODEP)
@COND_PLATFORM_MACOSX_1_TOOLKIT_COCOA@ $(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $<
@COND_PLATFORM_MACOSX_1_TOOLKIT_GTK@monolib_dlunix.o: $(srcdir)/src/unix/dlunix.cpp $(MONOLIB_ODEP)
@COND_PLATFORM_MACOSX_1_TOOLKIT_GTK@ $(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $<
@COND_PLATFORM_MACOSX_1_TOOLKIT_X11@monolib_dlunix.o: $(srcdir)/src/unix/dlunix.cpp $(MONOLIB_ODEP)
@COND_PLATFORM_MACOSX_1_TOOLKIT_X11@ $(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $<
@COND_PLATFORM_MACOSX_1_TOOLKIT_MOTIF@monolib_dlunix.o: $(srcdir)/src/unix/dlunix.cpp $(MONOLIB_ODEP)
@COND_PLATFORM_MACOSX_1_TOOLKIT_MOTIF@ $(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $<
@COND_PLATFORM_MACOSX_1_TOOLKIT_@monolib_dlunix.o: $(srcdir)/src/unix/dlunix.cpp $(MONOLIB_ODEP)
@COND_PLATFORM_MACOSX_1_TOOLKIT_@ $(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $<
@COND_PLATFORM_UNIX_1@monolib_mimetype.o: $(srcdir)/src/unix/mimetype.cpp $(MONOLIB_ODEP)
@COND_PLATFORM_UNIX_1@ $(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $<
@ -16200,6 +16303,12 @@ monolib_gprint.o: $(srcdir)/src/gtk/gnome/gprint.cpp $(MONOLIB_ODEP)
@COND_TOOLKIT_X11_USE_GUI_1@monolib_taskbarcmn.o: $(srcdir)/src/common/taskbarcmn.cpp $(MONOLIB_ODEP)
@COND_TOOLKIT_X11_USE_GUI_1@ $(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $<
@COND_TOOLKIT_MSW_USE_GUI_1@monolib_datectrl.o: $(srcdir)/src/msw/datectrl.cpp $(MONOLIB_ODEP)
@COND_TOOLKIT_MSW_USE_GUI_1@ $(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $<
@COND_TOOLKIT_WINCE_USE_GUI_1@monolib_datectrl.o: $(srcdir)/src/msw/datectrl.cpp $(MONOLIB_ODEP)
@COND_TOOLKIT_WINCE_USE_GUI_1@ $(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $<
@COND_TOOLKIT_MSW_USE_GUI_1@monolib_taskbar.o: $(srcdir)/src/msw/taskbar.cpp $(MONOLIB_ODEP)
@COND_TOOLKIT_MSW_USE_GUI_1@ $(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $<
@ -16536,6 +16645,27 @@ basedll_uma.o: $(srcdir)/src/mac/carbon/uma.cpp $(BASEDLL_ODEP)
@COND_PLATFORM_OS2_1@basedll_dir.o: $(srcdir)/src/os2/dir.cpp $(BASEDLL_ODEP)
@COND_PLATFORM_OS2_1@ $(CXXC) -c -o $@ $(BASEDLL_CXXFLAGS) $<
@COND_PLATFORM_UNIX_1@basedll_dlunix.o: $(srcdir)/src/unix/dlunix.cpp $(BASEDLL_ODEP)
@COND_PLATFORM_UNIX_1@ $(CXXC) -c -o $@ $(BASEDLL_CXXFLAGS) $<
@COND_PLATFORM_MACOSX_1_TOOLKIT_MAC@basedll_dlunix.o: $(srcdir)/src/unix/dlunix.cpp $(BASEDLL_ODEP)
@COND_PLATFORM_MACOSX_1_TOOLKIT_MAC@ $(CXXC) -c -o $@ $(BASEDLL_CXXFLAGS) $<
@COND_PLATFORM_MACOSX_1_TOOLKIT_COCOA@basedll_dlunix.o: $(srcdir)/src/unix/dlunix.cpp $(BASEDLL_ODEP)
@COND_PLATFORM_MACOSX_1_TOOLKIT_COCOA@ $(CXXC) -c -o $@ $(BASEDLL_CXXFLAGS) $<
@COND_PLATFORM_MACOSX_1_TOOLKIT_GTK@basedll_dlunix.o: $(srcdir)/src/unix/dlunix.cpp $(BASEDLL_ODEP)
@COND_PLATFORM_MACOSX_1_TOOLKIT_GTK@ $(CXXC) -c -o $@ $(BASEDLL_CXXFLAGS) $<
@COND_PLATFORM_MACOSX_1_TOOLKIT_X11@basedll_dlunix.o: $(srcdir)/src/unix/dlunix.cpp $(BASEDLL_ODEP)
@COND_PLATFORM_MACOSX_1_TOOLKIT_X11@ $(CXXC) -c -o $@ $(BASEDLL_CXXFLAGS) $<
@COND_PLATFORM_MACOSX_1_TOOLKIT_MOTIF@basedll_dlunix.o: $(srcdir)/src/unix/dlunix.cpp $(BASEDLL_ODEP)
@COND_PLATFORM_MACOSX_1_TOOLKIT_MOTIF@ $(CXXC) -c -o $@ $(BASEDLL_CXXFLAGS) $<
@COND_PLATFORM_MACOSX_1_TOOLKIT_@basedll_dlunix.o: $(srcdir)/src/unix/dlunix.cpp $(BASEDLL_ODEP)
@COND_PLATFORM_MACOSX_1_TOOLKIT_@ $(CXXC) -c -o $@ $(BASEDLL_CXXFLAGS) $<
@COND_PLATFORM_UNIX_1@basedll_mimetype.o: $(srcdir)/src/unix/mimetype.cpp $(BASEDLL_ODEP)
@COND_PLATFORM_UNIX_1@ $(CXXC) -c -o $@ $(BASEDLL_CXXFLAGS) $<
@ -17010,6 +17140,27 @@ baselib_uma.o: $(srcdir)/src/mac/carbon/uma.cpp $(BASELIB_ODEP)
@COND_PLATFORM_OS2_1@baselib_dir.o: $(srcdir)/src/os2/dir.cpp $(BASELIB_ODEP)
@COND_PLATFORM_OS2_1@ $(CXXC) -c -o $@ $(BASELIB_CXXFLAGS) $<
@COND_PLATFORM_UNIX_1@baselib_dlunix.o: $(srcdir)/src/unix/dlunix.cpp $(BASELIB_ODEP)
@COND_PLATFORM_UNIX_1@ $(CXXC) -c -o $@ $(BASELIB_CXXFLAGS) $<
@COND_PLATFORM_MACOSX_1_TOOLKIT_MAC@baselib_dlunix.o: $(srcdir)/src/unix/dlunix.cpp $(BASELIB_ODEP)
@COND_PLATFORM_MACOSX_1_TOOLKIT_MAC@ $(CXXC) -c -o $@ $(BASELIB_CXXFLAGS) $<
@COND_PLATFORM_MACOSX_1_TOOLKIT_COCOA@baselib_dlunix.o: $(srcdir)/src/unix/dlunix.cpp $(BASELIB_ODEP)
@COND_PLATFORM_MACOSX_1_TOOLKIT_COCOA@ $(CXXC) -c -o $@ $(BASELIB_CXXFLAGS) $<
@COND_PLATFORM_MACOSX_1_TOOLKIT_GTK@baselib_dlunix.o: $(srcdir)/src/unix/dlunix.cpp $(BASELIB_ODEP)
@COND_PLATFORM_MACOSX_1_TOOLKIT_GTK@ $(CXXC) -c -o $@ $(BASELIB_CXXFLAGS) $<
@COND_PLATFORM_MACOSX_1_TOOLKIT_X11@baselib_dlunix.o: $(srcdir)/src/unix/dlunix.cpp $(BASELIB_ODEP)
@COND_PLATFORM_MACOSX_1_TOOLKIT_X11@ $(CXXC) -c -o $@ $(BASELIB_CXXFLAGS) $<
@COND_PLATFORM_MACOSX_1_TOOLKIT_MOTIF@baselib_dlunix.o: $(srcdir)/src/unix/dlunix.cpp $(BASELIB_ODEP)
@COND_PLATFORM_MACOSX_1_TOOLKIT_MOTIF@ $(CXXC) -c -o $@ $(BASELIB_CXXFLAGS) $<
@COND_PLATFORM_MACOSX_1_TOOLKIT_@baselib_dlunix.o: $(srcdir)/src/unix/dlunix.cpp $(BASELIB_ODEP)
@COND_PLATFORM_MACOSX_1_TOOLKIT_@ $(CXXC) -c -o $@ $(BASELIB_CXXFLAGS) $<
@COND_PLATFORM_UNIX_1@baselib_mimetype.o: $(srcdir)/src/unix/mimetype.cpp $(BASELIB_ODEP)
@COND_PLATFORM_UNIX_1@ $(CXXC) -c -o $@ $(BASELIB_CXXFLAGS) $<
@ -22356,6 +22507,12 @@ advdll_gprint.o: $(srcdir)/src/gtk/gnome/gprint.cpp $(ADVDLL_ODEP)
@COND_TOOLKIT_X11@advdll_taskbarcmn.o: $(srcdir)/src/common/taskbarcmn.cpp $(ADVDLL_ODEP)
@COND_TOOLKIT_X11@ $(CXXC) -c -o $@ $(ADVDLL_CXXFLAGS) $<
@COND_TOOLKIT_MSW@advdll_datectrl.o: $(srcdir)/src/msw/datectrl.cpp $(ADVDLL_ODEP)
@COND_TOOLKIT_MSW@ $(CXXC) -c -o $@ $(ADVDLL_CXXFLAGS) $<
@COND_TOOLKIT_WINCE@advdll_datectrl.o: $(srcdir)/src/msw/datectrl.cpp $(ADVDLL_ODEP)
@COND_TOOLKIT_WINCE@ $(CXXC) -c -o $@ $(ADVDLL_CXXFLAGS) $<
@COND_TOOLKIT_MSW@advdll_sound.o: $(srcdir)/src/msw/sound.cpp $(ADVDLL_ODEP)
@COND_TOOLKIT_MSW@ $(CXXC) -c -o $@ $(ADVDLL_CXXFLAGS) $<
@ -22482,6 +22639,12 @@ advlib_gprint.o: $(srcdir)/src/gtk/gnome/gprint.cpp $(ADVLIB_ODEP)
@COND_TOOLKIT_X11@advlib_taskbarcmn.o: $(srcdir)/src/common/taskbarcmn.cpp $(ADVLIB_ODEP)
@COND_TOOLKIT_X11@ $(CXXC) -c -o $@ $(ADVLIB_CXXFLAGS) $<
@COND_TOOLKIT_MSW@advlib_datectrl.o: $(srcdir)/src/msw/datectrl.cpp $(ADVLIB_ODEP)
@COND_TOOLKIT_MSW@ $(CXXC) -c -o $@ $(ADVLIB_CXXFLAGS) $<
@COND_TOOLKIT_WINCE@advlib_datectrl.o: $(srcdir)/src/msw/datectrl.cpp $(ADVLIB_ODEP)
@COND_TOOLKIT_WINCE@ $(CXXC) -c -o $@ $(ADVLIB_CXXFLAGS) $<
@COND_TOOLKIT_MSW@advlib_sound.o: $(srcdir)/src/msw/sound.cpp $(ADVLIB_ODEP)
@COND_TOOLKIT_MSW@ $(CXXC) -c -o $@ $(ADVLIB_CXXFLAGS) $<

View File

@ -49,6 +49,7 @@ IMPORTANT: please read docs/tech/tn0016.txt before modifying this file!
<set var="BASE_UNIX_SRC" hints="files">
src/unix/baseunix.cpp
src/unix/dir.cpp
src/unix/dlunix.cpp
src/unix/mimetype.cpp
src/unix/snglinst.cpp
src/unix/stdpaths.cpp
@ -167,6 +168,7 @@ IMPORTANT: please read docs/tech/tn0016.txt before modifying this file!
<!-- Base files used only by OS X builds (not CarbonLib or Classic) -->
<set var="BASE_MAC_OSX_SRC" hints="files">
src/unix/baseunix.cpp
src/unix/dlunix.cpp
src/unix/stdpaths.cpp
</set>
<set var="BASE_MAC_OSX_HDR" hints="files">

View File

@ -33,6 +33,10 @@
#include "wx/msw/private.h"
#endif
#if defined(HAVE_DLERROR) && !defined(__EMX__)
#define wxHAVE_DYNLIB_ERROR
#endif
class WXDLLIMPEXP_BASE wxDynamicLibraryDetailsCreator;
// ----------------------------------------------------------------------------
@ -196,8 +200,8 @@ public:
// raw function for loading dynamic libs: always behaves as if
// wxDL_VERBATIM were specified and doesn't log error message if the
// library couldn't be loaded but simply returns NULL
static wxDllType RawLoad(const wxString& libname);
static wxDllType RawLoad(const wxString& libname, int flags = wxDL_DEFAULT);
// detach the library object from its handle, i.e. prevent the object from
// unloading the library in its dtor -- the caller is now responsible for
// doing this
@ -271,6 +275,11 @@ protected:
// common part of GetSymbol() and HasSymbol()
void *DoGetSymbol(const wxString& name, bool *success = 0) const;
#ifdef wxHAVE_DYNLIB_ERROR
// log the error after a dlxxx() function failure
static void Error();
#endif // wxHAVE_DYNLIB_ERROR
// platform specific shared lib suffix.
static const wxChar *ms_dllext;

View File

@ -5,10 +5,14 @@
// Modified by:
// Created: 20/07/98
// RCS-ID: $Id$
// Copyright: (c) Guilhem Lavaux
// Copyright: (c) 1998 Guilhem Lavaux
// 2000-2005 Vadim Zeitlin
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
//FIXME: This class isn't really common at all, it should be moved into
// platform dependent files (already done for Windows and Unix)
// ============================================================================
// declarations
// ============================================================================
@ -50,135 +54,27 @@ WX_DEFINE_USER_EXPORTED_OBJARRAY(wxDynamicLibraryDetailsArray);
// implementation
// ============================================================================
#if defined(__DARWIN__)
// ---------------------------------------------------------------------------
// For Darwin/Mac OS X
// supply the sun style dlopen functions in terms of Darwin NS*
// ---------------------------------------------------------------------------
/* Porting notes:
* The dlopen port is a port from dl_next.xs by Anno Siegel.
* dl_next.xs is itself a port from dl_dlopen.xs by Paul Marquess.
* The method used here is just to supply the sun style dlopen etc.
* functions in terms of Darwin NS*.
*/
#include <stdio.h>
#include <mach-o/dyld.h>
static char dl_last_error[1024];
static
void TranslateError(const char *path, int number)
{
unsigned int index;
static char *OFIErrorStrings[] =
{
"%s(%d): Object Image Load Failure\n",
"%s(%d): Object Image Load Success\n",
"%s(%d): Not an recognisable object file\n",
"%s(%d): No valid architecture\n",
"%s(%d): Object image has an invalid format\n",
"%s(%d): Invalid access (permissions?)\n",
"%s(%d): Unknown error code from NSCreateObjectFileImageFromFile\n",
};
#define NUM_OFI_ERRORS (sizeof(OFIErrorStrings) / sizeof(OFIErrorStrings[0]))
index = number;
if (index > NUM_OFI_ERRORS - 1) {
index = NUM_OFI_ERRORS - 1;
}
sprintf(dl_last_error, OFIErrorStrings[index], path, number);
}
const char *dlerror()
{
return dl_last_error;
}
void *dlopen(const char *path, int WXUNUSED(mode) /* mode is ignored */)
{
NSObjectFileImage ofile;
NSModule handle = NULL;
int dyld_result = NSCreateObjectFileImageFromFile(path, &ofile);
if ( dyld_result != NSObjectFileImageSuccess )
{
handle = NULL;
}
else
{
handle = NSLinkModule
(
ofile,
path,
NSLINKMODULE_OPTION_BINDNOW |
NSLINKMODULE_OPTION_RETURN_ON_ERROR
);
}
if ( !handle )
TranslateError(path, dyld_result);
return handle;
}
int dlclose(void *handle)
{
NSUnLinkModule( handle, NSUNLINKMODULE_OPTION_NONE);
return 0;
}
void *dlsym(void *handle, const char *symbol)
{
// as on many other systems, C symbols have prepended underscores under
// Darwin but unlike the normal dlopen(), NSLookupSymbolInModule() is not
// aware of this
wxCharBuffer buf(strlen(symbol) + 1);
char *p = buf.data();
p[0] = '_';
strcpy(p + 1, symbol);
NSSymbol nsSymbol = NSLookupSymbolInModule( handle, p );
return nsSymbol ? NSAddressOfSymbol(nsSymbol) : NULL;
}
#endif // defined(__DARWIN__)
// ---------------------------------------------------------------------------
// wxDynamicLibrary
// ---------------------------------------------------------------------------
//FIXME: This class isn't really common at all, it should be moved into
// platform dependent files (already done for Windows)
#if defined(__WXPM__) || defined(__EMX__)
const wxChar *wxDynamicLibrary::ms_dllext = _T(".dll");
#elif defined(__WXMAC__) && !defined(__DARWIN__)
const wxChar *wxDynamicLibrary::ms_dllext = _T("");
#elif defined(__UNIX__)
#if defined(__HPUX__)
const wxChar *wxDynamicLibrary::ms_dllext = _T(".sl");
#elif defined(__DARWIN__)
const wxChar *wxDynamicLibrary::ms_dllext = _T(".bundle");
#else
const wxChar *wxDynamicLibrary::ms_dllext = _T(".so");
#endif
#endif
// for Unix it is in src/unix/dlunix.cpp
#ifndef __UNIX__
wxDllType wxDynamicLibrary::GetProgramHandle()
{
#if defined( HAVE_DLOPEN ) && !defined(__EMX__)
return dlopen(0, RTLD_LAZY);
#elif defined (HAVE_SHL_LOAD)
return PROG_HANDLE;
#else
wxFAIL_MSG( wxT("This method is not implemented under Windows or OS/2"));
wxFAIL_MSG( wxT("GetProgramHandle() is not implemented under this platform"));
return 0;
#endif
}
#endif // __UNIX__
bool wxDynamicLibrary::Load(const wxString& libnameOrig, int flags)
{
wxASSERT_MSG(m_handle == 0, _T("Library already loaded."));
@ -224,99 +120,32 @@ bool wxDynamicLibrary::Load(const wxString& libnameOrig, int flags)
#elif defined(__WXPM__) || defined(__EMX__)
char err[256] = "";
DosLoadModule(err, sizeof(err), libname.c_str(), &m_handle);
#elif defined(HAVE_DLOPEN) || defined(__DARWIN__)
#if defined(__VMS) || defined(__DARWIN__)
m_handle = dlopen(libname.fn_str(), 0); // The second parameter is ignored
#else // !__VMS && !__DARWIN__
int rtldFlags = 0;
if ( flags & wxDL_LAZY )
{
wxASSERT_MSG( (flags & wxDL_NOW) == 0,
_T("wxDL_LAZY and wxDL_NOW are mutually exclusive.") );
#ifdef RTLD_LAZY
rtldFlags |= RTLD_LAZY;
#else
wxLogDebug(_T("wxDL_LAZY is not supported on this platform"));
#endif
}
else if ( flags & wxDL_NOW )
{
#ifdef RTLD_NOW
rtldFlags |= RTLD_NOW;
#else
wxLogDebug(_T("wxDL_NOW is not supported on this platform"));
#endif
}
if ( flags & wxDL_GLOBAL )
{
#ifdef RTLD_GLOBAL
rtldFlags |= RTLD_GLOBAL;
#else
wxLogDebug(_T("RTLD_GLOBAL is not supported on this platform."));
#endif
}
m_handle = dlopen(libname.fn_str(), rtldFlags);
#endif // __VMS || __DARWIN__ ?
#elif defined(HAVE_SHL_LOAD)
int shlFlags = 0;
if( flags & wxDL_LAZY )
{
wxASSERT_MSG( (flags & wxDL_NOW) == 0,
_T("wxDL_LAZY and wxDL_NOW are mutually exclusive.") );
shlFlags |= BIND_DEFERRED;
}
else if( flags & wxDL_NOW )
{
shlFlags |= BIND_IMMEDIATE;
}
m_handle = shl_load(libname.fn_str(), BIND_DEFERRED, 0);
#elif defined(__WINDOWS__)
m_handle = RawLoad(libname);
#else
#error "runtime shared lib support not implemented on this platform"
m_handle = RawLoad(libname, flags);
#endif
if ( m_handle == 0 )
{
wxString msg(_("Failed to load shared library '%s'"));
#if defined(HAVE_DLERROR) && !defined(__EMX__)
#if wxUSE_UNICODE
wxWCharBuffer buffer = wxConvLocal.cMB2WC( dlerror() );
const wxChar *err = buffer;
#ifdef wxHAVE_DYNLIB_ERROR
Error();
#else
const wxChar *err = dlerror();
#endif
if( err )
wxLogError( msg, err );
#else
wxLogSysError( msg, libname.c_str() );
wxLogSysError(_("Failed to load shared library '%s'"), libname.c_str());
#endif
}
return IsLoaded();
}
#ifndef __WXMSW__
// for MSW and Unix this is implemented in the platform-specific file
//
// TODO: move the rest to os2/dlpm.cpp and mac/dlmac.cpp!
#if !defined(__WXMSW__) && !defined(__UNIX__)
/* static */
void wxDynamicLibrary::Unload(wxDllType handle)
{
#if defined(__WXPM__) || defined(__EMX__)
DosFreeModule( handle );
#elif defined(HAVE_DLOPEN) || defined(__DARWIN__)
dlclose( handle );
#elif defined(HAVE_SHL_LOAD)
shl_unload( handle );
#elif defined(__WXMAC__) && !defined(__DARWIN__)
CloseConnection( (CFragConnectionID*) &handle );
#else
@ -324,7 +153,7 @@ void wxDynamicLibrary::Unload(wxDllType handle)
#endif
}
#endif // !__WXMSW__
#endif // !(__WXMSW__ || __UNIX__)
void *wxDynamicLibrary::DoGetSymbol(const wxString &name, bool *success) const
{
@ -346,24 +175,10 @@ void *wxDynamicLibrary::DoGetSymbol(const wxString &name, bool *success) const
#endif
if( FindSymbol( m_handle, symName, &symAddress, &symClass ) == noErr )
symbol = (void *)symAddress;
#elif defined(__WXPM__) || defined(__EMX__)
DosQueryProcAddr( m_handle, 1L, name.c_str(), (PFN*)symbol );
#elif defined(HAVE_DLOPEN) || defined(__DARWIN__)
symbol = dlsym( m_handle, name.fn_str() );
#elif defined(HAVE_SHL_LOAD)
// use local variable since shl_findsym modifies the handle argument
// to indicate where the symbol was found (GD)
wxDllType the_handle = m_handle;
if( shl_findsym( &the_handle, name.fn_str(), TYPE_UNDEFINED, &symbol ) != 0 )
symbol = 0;
#elif defined(__WINDOWS__)
symbol = RawGetSymbol(m_handle, name);
#else
#error "runtime shared lib support not implemented"
symbol = RawGetSymbol(m_handle, name);
#endif
if ( success )
@ -377,19 +192,8 @@ void *wxDynamicLibrary::GetSymbol(const wxString& name, bool *success) const
void *symbol = DoGetSymbol(name, success);
if ( !symbol )
{
#if defined(HAVE_DLERROR) && !defined(__EMX__)
#if wxUSE_UNICODE
wxWCharBuffer buffer = wxConvLocal.cMB2WC( dlerror() );
const wxChar *err = buffer;
#else
const wxChar *err = dlerror();
#endif
if( err )
{
wxLogError(wxT("%s"), err);
}
#ifdef wxHAVE_DYNLIB_ERROR
Error();
#else
wxLogSysError(_("Couldn't find symbol '%s' in a dynamic library"),
name.c_str());
@ -406,13 +210,7 @@ void *wxDynamicLibrary::GetSymbol(const wxString& name, bool *success) const
/*static*/
wxString
wxDynamicLibrary::CanonicalizeName(const wxString& name,
wxDynamicLibraryCategory
#ifdef __UNIX__
cat
#else // !__UNIX__
WXUNUSED(cat)
#endif // __UNIX__/!__UNIX__
)
wxDynamicLibraryCategory cat)
{
wxString nameCanonic;
@ -433,7 +231,9 @@ wxDynamicLibrary::CanonicalizeName(const wxString& name,
nameCanonic = _T("lib");
break;
}
#endif // __UNIX__
#else // !__UNIX__
wxUnusedVar(cat);
#endif // __UNIX__/!__UNIX__
nameCanonic << name << GetDllExt();
return nameCanonic;

View File

@ -247,7 +247,8 @@ wxDynamicLibraryDetailsCreator::EnumModulesProc(PSTR name,
// ----------------------------------------------------------------------------
/* static */
wxDllType wxDynamicLibrary::RawLoad(const wxString& libname)
wxDllType
wxDynamicLibrary::RawLoad(const wxString& libname, int WXUNUSED(flags))
{
return ::LoadLibrary(libname);
}

264
src/unix/dlunix.cpp Normal file
View File

@ -0,0 +1,264 @@
/////////////////////////////////////////////////////////////////////////////
// Name: unix/dlunix.cpp
// Purpose: Unix-specific part of wxDynamicLibrary and related classes
// Author: Vadim Zeitlin
// Modified by:
// Created: 2005-01-16 (extracted from common/dynlib.cpp)
// RCS-ID: $Id$
// Copyright: (c) 2000-2005 Vadim Zeitlin <vadim@wxwindows.org>
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
// ============================================================================
// declarations
// ============================================================================
// ----------------------------------------------------------------------------
// headers
// ----------------------------------------------------------------------------
#include "wx/wxprec.h"
#ifdef __BORLANDC__
#pragma hdrstop
#endif
#if wxUSE_DYNLIB_CLASS
#include "wx/dynlib.h"
#if defined(HAVE_DLOPEN) || defined(__DARWIN__)
#define USE_POSIX_DL_FUNCS
#elif !defined(HAVE_SHL_LOAD)
#error "Don't know how to load dynamic libraries on this platform!"
#endif
// ----------------------------------------------------------------------------
// constants
// ----------------------------------------------------------------------------
// standard shared libraries extensions for different Unix versions
#if defined(__HPUX__)
const wxChar *wxDynamicLibrary::ms_dllext = _T(".sl");
#elif defined(__DARWIN__)
const wxChar *wxDynamicLibrary::ms_dllext = _T(".bundle");
#else
const wxChar *wxDynamicLibrary::ms_dllext = _T(".so");
#endif
// ============================================================================
// wxDynamicLibrary implementation
// ============================================================================
// ----------------------------------------------------------------------------
// dlxxx() emulation for Darwin
// ----------------------------------------------------------------------------
#if defined(__DARWIN__)
// ---------------------------------------------------------------------------
// For Darwin/Mac OS X
// supply the sun style dlopen functions in terms of Darwin NS*
// ---------------------------------------------------------------------------
/* Porting notes:
* The dlopen port is a port from dl_next.xs by Anno Siegel.
* dl_next.xs is itself a port from dl_dlopen.xs by Paul Marquess.
* The method used here is just to supply the sun style dlopen etc.
* functions in terms of Darwin NS*.
*/
#include <stdio.h>
#include <mach-o/dyld.h>
static char dl_last_error[1024];
static
void TranslateError(const char *path, int number)
{
unsigned int index;
static char *OFIErrorStrings[] =
{
"%s(%d): Object Image Load Failure\n",
"%s(%d): Object Image Load Success\n",
"%s(%d): Not an recognisable object file\n",
"%s(%d): No valid architecture\n",
"%s(%d): Object image has an invalid format\n",
"%s(%d): Invalid access (permissions?)\n",
"%s(%d): Unknown error code from NSCreateObjectFileImageFromFile\n",
};
#define NUM_OFI_ERRORS (sizeof(OFIErrorStrings) / sizeof(OFIErrorStrings[0]))
index = number;
if (index > NUM_OFI_ERRORS - 1) {
index = NUM_OFI_ERRORS - 1;
}
sprintf(dl_last_error, OFIErrorStrings[index], path, number);
}
const char *dlerror()
{
return dl_last_error;
}
void *dlopen(const char *path, int WXUNUSED(mode) /* mode is ignored */)
{
NSObjectFileImage ofile;
NSModule handle = NULL;
int dyld_result = NSCreateObjectFileImageFromFile(path, &ofile);
if ( dyld_result != NSObjectFileImageSuccess )
{
handle = NULL;
}
else
{
handle = NSLinkModule
(
ofile,
path,
NSLINKMODULE_OPTION_BINDNOW |
NSLINKMODULE_OPTION_RETURN_ON_ERROR
);
}
if ( !handle )
TranslateError(path, dyld_result);
return handle;
}
int dlclose(void *handle)
{
NSUnLinkModule( handle, NSUNLINKMODULE_OPTION_NONE);
return 0;
}
void *dlsym(void *handle, const char *symbol)
{
// as on many other systems, C symbols have prepended underscores under
// Darwin but unlike the normal dlopen(), NSLookupSymbolInModule() is not
// aware of this
wxCharBuffer buf(strlen(symbol) + 1);
char *p = buf.data();
p[0] = '_';
strcpy(p + 1, symbol);
NSSymbol nsSymbol = NSLookupSymbolInModule( handle, p );
return nsSymbol ? NSAddressOfSymbol(nsSymbol) : NULL;
}
#endif // defined(__DARWIN__)
// ----------------------------------------------------------------------------
// loading/unloading DLLs
// ----------------------------------------------------------------------------
wxDllType wxDynamicLibrary::GetProgramHandle()
{
#ifdef USE_POSIX_DL_FUNCS
return dlopen(0, RTLD_LAZY);
#else
return PROG_HANDLE;
#endif
}
/* static */
wxDllType wxDynamicLibrary::RawLoad(const wxString& libname, int flags)
{
wxASSERT_MSG( (flags & wxDL_NOW) == 0,
_T("wxDL_LAZY and wxDL_NOW are mutually exclusive.") );
#ifdef USE_POSIX_DL_FUNCS
int rtldFlags = 0;
#ifdef RTLD_LAZY
if ( flags & wxDL_LAZY )
{
rtldFlags |= RTLD_LAZY;
}
#endif
#ifdef RTLD_NOW
if ( flags & wxDL_NOW )
{
rtldFlags |= RTLD_NOW;
}
#endif
#ifdef RTLD_GLOBAL
if ( flags & wxDL_GLOBAL )
{
rtldFlags |= RTLD_GLOBAL;
}
#endif
return dlopen(libname.fn_str(), rtldFlags);
#else // !USE_POSIX_DL_FUNCS
int shlFlags = 0;
if ( flags & wxDL_LAZY )
{
shlFlags |= BIND_DEFERRED;
}
else if ( flags & wxDL_NOW )
{
shlFlags |= BIND_IMMEDIATE;
}
return shl_load(libname.fn_str(), shlFlags, 0);
#endif // USE_POSIX_DL_FUNCS/!USE_POSIX_DL_FUNCS
}
/* static */
void wxDynamicLibrary::Unload(wxDllType handle)
{
#ifdef wxHAVE_DYNLIB_ERROR
int rc =
#endif
#ifdef USE_POSIX_DL_FUNCS
dlclose(handle);
#else // !USE_POSIX_DL_FUNCS
shl_unload(handle);
#endif // USE_POSIX_DL_FUNCS/!USE_POSIX_DL_FUNCS
#ifdef USE_POSIX_DL_FUNCS
if ( rc != 0 )
Error();
#endif
}
/* static */
void *wxDynamicLibrary::RawGetSymbol(wxDllType handle, const wxString& name)
{
void *symbol;
#ifdef USE_POSIX_DL_FUNCS
symbol = dlsym(handle, name.fn_str());
#else // !USE_POSIX_DL_FUNCS
// note that shl_findsym modifies the handle argument to indicate where the
// symbol was found, but it's ok to modify the local handle copy here
if ( shl_findsym(&handle, name.fn_str(), TYPE_UNDEFINED, &symbol) != 0 )
symbol = 0;
#endif // USE_POSIX_DL_FUNCS/!USE_POSIX_DL_FUNCS
return symbol;
}
#ifdef wxHAVE_DYNLIB_ERROR
/* static */
void wxDynamicLibrary::Error()
{
#if wxUSE_UNICODE
wxWCharBuffer buffer = wxConvLocal.cMB2WC( dlerror() );
const wxChar *err = buffer;
#else
const wxChar *err = dlerror();
#endif
wxLogError(wxT("%s"), err ? err : _("Unknown dynamic library error"));
}
#endif // wxHAVE_DYNLIB_ERROR
#endif // wxUSE_DYNLIB_CLASS