~oxalin/lightspark/buildnaudioplugin

« back to all changes in this revision

Viewing changes to compat.cpp

  • Committer: Alessandro
  • Date: 2010-09-06 19:31:31 UTC
  • mfrom: (911.13.93)
  • Revision ID: git-v1:9f6175895e49dc81d39f6f99e66e2adc5a82bdb3
Merge branch 'master' of http://github.com/Oxalin/lightspark

Conflicts:
        CMakeLists.txt
        scripting/flashnet.cpp

Show diffs side-by-side

added added

removed removed

Lines of Context:
17
17
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
18
18
**************************************************************************/
19
19
 
20
 
#ifndef WIN32
21
 
#include <unistd.h>
22
 
#include <time.h>
 
20
#if defined WIN32
 
21
  #include <windows.h>
 
22
#else
 
23
  #include <unistd.h>
 
24
  #include <time.h>
 
25
  #include <dlfcn.h>
23
26
#include <sys/wait.h>
24
27
#endif
25
28
 
62
65
#endif
63
66
}
64
67
 
 
68
HMODULE LoadLib(const string filename)
 
69
{
 
70
  HMODULE ret;
 
71
#if defined WIN32
 
72
    ret = LoadLibrary(filename.c_str());
 
73
#else
 
74
  dlerror(); //clearing any remaining error
 
75
  ret = dlopen(filename.c_str(), RTLD_LAZY);
 
76
  if(!ret)
 
77
  {
 
78
    cerr << "Cannot open plugin: " << dlerror() << endl;
 
79
  }
 
80
#endif
 
81
  return ret;
 
82
}
 
83
 
 
84
void *ExtractLibContent(HMODULE hLib, string WhatToExtract)
 
85
{
 
86
  void *ret;
 
87
#if defined WIN32
 
88
  ret = GetProcAdress(hLib, WhatToExtract.c_str());
 
89
#else
 
90
  dlerror(); //clearing any remaining error
 
91
  ret = dlsym(hLib, WhatToExtract.c_str());
 
92
  if(!ret)
 
93
  {
 
94
    cerr << "Cannot load symbol: " << dlerror() << endl;
 
95
  }
 
96
#endif
 
97
  return ret;
 
98
}
 
99
 
 
100
void CloseLib(HMODULE hLib)
 
101
{
 
102
  #if defined WIN32
 
103
    FreeLibrary(hLib);
 
104
  #else
 
105
    dlclose(hLib);
 
106
  #endif
 
107
  hLib = NULL;
 
108
}
 
109
 
65
110
 
66
111
#ifndef WIN32
67
112
#include "timer.h"