* Added source file info in utils/serialize/*
* Added Windows support in dynlib.cpp (not tested) * Added some operator in wxStream * Added a mutex in thread sample (more later) git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@441 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -26,6 +26,10 @@
|
||||
#include <dlfcn.h>
|
||||
#endif
|
||||
|
||||
#ifdef __WINDOWS__
|
||||
#include <windows.h>
|
||||
#endif
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Global variables
|
||||
// ---------------------------------------------------------------------------
|
||||
@@ -59,7 +63,12 @@ wxLibrary::~wxLibrary()
|
||||
else
|
||||
delete m_liblist;
|
||||
|
||||
#ifdef linux
|
||||
dlclose(m_handle);
|
||||
#endif
|
||||
#ifdef __WINDOWS__
|
||||
FreeLibrary((HMODULE)m_handle);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
@@ -71,8 +80,12 @@ wxObject *wxLibrary::CreateObject(const wxString& name)
|
||||
void *wxLibrary::GetSymbol(const wxString& symbname)
|
||||
{
|
||||
#ifdef linux
|
||||
return dlsym(m_handle, symbname.GetData());
|
||||
return dlsym(m_handle, WXSTRINGCAST symbname);
|
||||
#endif
|
||||
#ifdef __WINDOWS__
|
||||
return GetProcAddress(m_handle, WXSTRINGCAST symbname);
|
||||
#endif
|
||||
return NULL;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
@@ -105,21 +118,24 @@ wxLibrary *wxLibraries::LoadLibrary(const wxString& name)
|
||||
return ((wxLibrary *)node->Data());
|
||||
|
||||
#ifdef linux
|
||||
lib_name.Prepend("./lib");
|
||||
lib_name.Prepend("lib");
|
||||
lib_name += ".so";
|
||||
|
||||
printf("lib_name = %s\n", WXSTRINGCAST lib_name);
|
||||
|
||||
void *handle = dlopen(lib_name.GetData(), RTLD_LAZY);
|
||||
|
||||
printf("handle = %x\n", handle);
|
||||
lib = new wxLibrary(handle);
|
||||
void *handle = dlopen(WXSTRINGCAST lib_name, RTLD_LAZY);
|
||||
|
||||
if (!handle)
|
||||
return NULL;
|
||||
#endif
|
||||
#ifdef __WINDOWS__
|
||||
lib_name += ".dll";
|
||||
|
||||
HMODULE handle = LoadLibrary(lib_name);
|
||||
if (!handle)
|
||||
return NULL;
|
||||
#endif
|
||||
lib = new wxLibrary((void *)handle);
|
||||
|
||||
m_loaded.Append(name.GetData(), lib);
|
||||
return lib;
|
||||
|
@@ -18,6 +18,7 @@
|
||||
#include <ctype.h>
|
||||
#include <wx/stream.h>
|
||||
#include <wx/datstrm.h>
|
||||
#include <wx/objstrm.h>
|
||||
|
||||
#ifdef __BORLANDC__
|
||||
#pragma hdrstop
|
||||
@@ -270,6 +271,15 @@ wxInputStream& wxInputStream::operator>>(short& i)
|
||||
return *this;
|
||||
}
|
||||
|
||||
wxInputStream& wxInputStream::operator>>(int& i)
|
||||
{
|
||||
long l;
|
||||
|
||||
*this >> l;
|
||||
i = (short)l;
|
||||
return *this;
|
||||
}
|
||||
|
||||
wxInputStream& wxInputStream::operator>>(long& i)
|
||||
{
|
||||
/* I only implemented a simple integer parser */
|
||||
@@ -341,6 +351,13 @@ wxInputStream& wxInputStream::operator>>(float& f)
|
||||
return *this;
|
||||
}
|
||||
|
||||
wxInputStream& wxInputStream::operator>>(wxObject *& obj)
|
||||
{
|
||||
wxObjectInputStream obj_s(*this);
|
||||
obj = obj_s.LoadObject();
|
||||
return *this;
|
||||
}
|
||||
|
||||
off_t wxInputStream::SeekI(off_t pos, wxSeekMode mode)
|
||||
{
|
||||
off_t ret_off;
|
||||
@@ -504,6 +521,13 @@ wxOutputStream& wxOutputStream::operator<<(double f)
|
||||
return Write(strfloat, strfloat.Len());
|
||||
}
|
||||
|
||||
wxOutputStream& wxOutputStream::operator<<(wxObject& obj)
|
||||
{
|
||||
wxObjectOutputStream obj_s(*this);
|
||||
obj_s.SaveObject(obj);
|
||||
return *this;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxFilterInputStream
|
||||
// ----------------------------------------------------------------------------
|
||||
|
Reference in New Issue
Block a user