Skip to content

Commit c587673

Browse files
Merge branch 'develop-6.7' into merge-6.7.4-rc-1
Conflicts: engine/src/external.cpp engine/src/externalv0.cpp engine/src/util.cpp libexternal/src/external.c
2 parents a5dc33b + af4e162 commit c587673

8 files changed

Lines changed: 41 additions & 27 deletions

File tree

engine/src/external.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -275,7 +275,7 @@ MCExternal *MCExternal::Load(MCStringRef p_filename)
275275
// AL-2015-02-10: [[ SB Inclusions ]] Load external using new module loading utility
276276
MCAutoPointer<char> t_filename_cstring;
277277
if (MCStringConvertToCString(p_filename, &t_filename_cstring))
278-
t_module = MCU_loadmodule(*t_filename_cstring);
278+
t_module = (MCSysModuleHandle)MCU_loadmodule(*t_filename_cstring);
279279

280280
if (t_module == NULL)
281281
t_success = false;

engine/src/externalv0.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1685,7 +1685,7 @@ static char *load_module(const char *arg1, const char *arg2,
16851685
MCSysModuleHandle *t_result;
16861686
t_result = (MCSysModuleHandle *)arg2;
16871687

1688-
*t_result = MCU_loadmodule(arg1);
1688+
*t_result = (MCSysModuleHandle)MCU_loadmodule(arg1);
16891689

16901690
if (*t_result == nil)
16911691
*retval = xresFail;
@@ -1784,9 +1784,9 @@ XCB MCcbs[] =
17841784
set_array_utf8_binary,
17851785

17861786
// AL-2015-02-10: [[ SB Inclusions ]] Externals interface V3 functions
1787-
load_module,
1788-
unload_module,
1789-
resolve_symbol_in_module,
1787+
/* V3 */ load_module,
1788+
/* V3 */ unload_module,
1789+
/* V3 */ resolve_symbol_in_module,
17901790

17911791
NULL
17921792
};

engine/src/util.cpp

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3189,7 +3189,9 @@ bool MCU_random_bytes(size_t p_bytecount, MCDataRef& r_bytes)
31893189
// AL-2015-02-06: [[ SB Inclusions ]] Add utility functions for module loading where
31903190
// p_module can be a universal module name, where a mapping from module names to
31913191
// relative paths has been provided.
3192-
MCSysModuleHandle MCU_loadmodule(const char *p_module)
3192+
// SN-2015-02-23: [[ Broken Win Compilation ]] Use void*, as the function is imported
3193+
// as extern in revbrowser/src/cefshared.h - where MCSysModuleHandle does not exist
3194+
void* MCU_loadmodule(const char *p_module)
31933195
{
31943196
MCSysModuleHandle t_handle;
31953197
t_handle = nil;
@@ -3262,12 +3264,16 @@ MCSysModuleHandle MCU_loadmodule(const char *p_module)
32623264
return t_handle;
32633265
}
32643266

3265-
void MCU_unloadmodule(MCSysModuleHandle p_module)
3267+
// SN-2015-02-23: [[ Broken Win Compilation ]] Use void*, as the function is imported
3268+
// as extern in revbrowser/src/cefshared.h - where MCSysModuleHandle does not exist
3269+
void MCU_unloadmodule(void *p_module)
32663270
{
3267-
MCS_unloadmodule(p_module);
3271+
MCS_unloadmodule((MCSysModuleHandle)p_module);
32683272
}
32693273

3270-
void *MCU_resolvemodulesymbol(MCSysModuleHandle p_module, const char *p_symbol)
3274+
// SN-2015-02-23: [[ Broken Win Compilation ]] Use void*, as the function is imported
3275+
// as extern in revbrowser/src/cefshared.h - where MCSysModuleHandle does not exist
3276+
void *MCU_resolvemodulesymbol(void* p_module, const char *p_symbol)
32713277
{
32723278
#if defined(_MACOSX) || defined(_MAC_SERVER)
32733279
NSSymbol t_symbol;
@@ -3279,7 +3285,7 @@ void *MCU_resolvemodulesymbol(MCSysModuleHandle p_module, const char *p_symbol)
32793285
if (!MCStringCreateWithCString(p_symbol, &t_symbol_str))
32803286
return nil;
32813287

3282-
return MCS_resolvemodulesymbol(p_module, *t_symbol_str);
3288+
return MCS_resolvemodulesymbol((MCSysModuleHandle)p_module, *t_symbol_str);
32833289
}
32843290

32853291
///////////////////////////////////////////////////////////////////////////////

engine/src/util.h

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -241,9 +241,11 @@ extern double MCU_squared_distance_from_line(int4 sx, int4 sy, int4 ex, int4 ey,
241241
extern bool MCU_random_bytes(size_t p_bytecount, MCDataRef& r_bytes);
242242

243243
// AL-2015-02-06: [[ SB Inclusions ]] Add utility functions for module loading
244-
extern "C" MCSysModuleHandle MCU_loadmodule(const char *p_module);
245-
extern "C" void MCU_unloadmodule(MCSysModuleHandle p_module);
246-
extern "C" void *MCU_resolvemodulesymbol(MCSysModuleHandle p_module, const char *p_symbol);
244+
// SN-2015-02-23: [[ Broken Win Compilation ]] Use void*, as the function is imported
245+
// as extern in revbrowser/src/cefshared.h - where MCSysModuleHandle does not exist
246+
extern "C" void* MCU_loadmodule(const char *p_module);
247+
extern "C" void MCU_unloadmodule(void* p_module);
248+
extern "C" void *MCU_resolvemodulesymbol(void* p_module, const char *p_symbol);
247249

248250
//
249251

libexternal/include/revolution/external.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -497,7 +497,8 @@ extern void StackToWindowRect(unsigned int p_win_id, MCRectangle32 *x_rect, int
497497
extern void WindowToStackRect(unsigned int p_win_id, MCRectangle32 *x_rect, int *r_success);
498498

499499
// AL-2015-02-10: [[ SB Inclusions ]] Add wrappers for ExternalV0 module loading callbacks
500-
extern void LoadModule(const char *p_module, void **r_handle, int *r_success);
500+
// SN-2015-02-24: [[ Broken Win Compilation ]] LoadModule is a Win32 API function...
501+
extern void LoadModuleByName(const char *p_module, void **r_handle, int *r_success);
501502
extern void UnloadModule(void *p_handle, int *r_success);
502503
extern void ResolveSymbolInModule(void *p_handle, const char *p_symbol, void **r_resolved, int *r_success);
503504

libexternal/src/external.c

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -855,16 +855,17 @@ Bool SecurityCanAccessLibraryUTF8(const char *p_library)
855855
////////////////////////////////////////////////////////////////////////////////
856856

857857
// AL-2015-02-10: [[ SB Inclusions ]] Add wrappers for ExternalV0 module loading callbacks
858-
void LoadModule(const char *p_module, void **r_handle, int *r_success)
858+
// SN-2015-02-24: [[ Broken Win Compilation ]] LoadModule is a Win32 API function...
859+
void LoadModuleByName(const char *p_module, void **r_handle, int *r_success)
859860
{
860-
if (s_external_interface_version < 3 ||
861-
s_operations[OPERATION_LOAD_MODULE] == NULL)
861+
char *t_result;
862+
863+
if (s_external_interface_version < 3)
862864
{
863865
*r_success = EXTERNAL_FAILURE;
864866
return;
865867
}
866-
867-
char *t_result;
868+
868869
t_result = (s_operations[OPERATION_LOAD_MODULE])(p_module, (const char *)r_handle, NULL, r_success);
869870

870871
if (t_result != NULL)
@@ -873,13 +874,14 @@ void LoadModule(const char *p_module, void **r_handle, int *r_success)
873874

874875
void UnloadModule(void *p_handle, int *r_success)
875876
{
877+
char *t_result;
878+
876879
if (s_external_interface_version < 3)
877880
{
878881
*r_success = EXTERNAL_FAILURE;
879882
return;
880883
}
881-
882-
char *t_result;
884+
883885
t_result = (s_operations[OPERATION_UNLOAD_MODULE])(p_handle, NULL, NULL, r_success);
884886

885887
if (t_result != NULL)
@@ -888,13 +890,14 @@ void UnloadModule(void *p_handle, int *r_success)
888890

889891
void ResolveSymbolInModule(void *p_handle, const char *p_symbol, void **r_resolved, int *r_success)
890892
{
893+
char *t_result;
894+
891895
if (s_external_interface_version < 3)
892896
{
893897
*r_success = EXTERNAL_FAILURE;
894898
return;
895899
}
896-
897-
char *t_result;
900+
898901
t_result = (s_operations[OPERATION_RESOLVE_SYMBOL_IN_MODULE])(p_handle, p_symbol, (const char *)r_resolved, r_success);
899902

900903
if (t_result != NULL)

revbrowser/src/cefbrowser_w32.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -533,5 +533,5 @@ void MCU_unloadmodule(void *p_module)
533533

534534
void *MCU_resolvemodulesymbol(void *p_module, const char *p_name)
535535
{
536-
return GetProcAddress(p_module, p_name);
536+
return GetProcAddress((HMODULE)p_module, p_name);
537537
}

revdb/src/revdb.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ static void *DBcallback_loadmodule(const char *p_path)
139139
{
140140
int t_success;
141141
void *t_handle;
142-
LoadModule(p_path, &t_handle, &t_success);
142+
LoadModuleByName(p_path, &t_handle, &t_success);
143143
if (t_success == EXTERNAL_FAILURE)
144144
return NULL;
145145
return t_handle;
@@ -271,7 +271,7 @@ DATABASEREC *LoadDatabaseDriverFromName(const char *p_type)
271271
int t_retvalue;
272272
void *t_handle;
273273
t_handle = NULL;
274-
LoadModule(p_type, &t_handle, &t_retvalue);
274+
LoadModuleByName(p_type, &t_handle, &t_retvalue);
275275

276276
if (t_handle == NULL)
277277
return NULL;
@@ -280,8 +280,10 @@ DATABASEREC *LoadDatabaseDriverFromName(const char *p_type)
280280
t_result = new DATABASEREC;
281281
#if (defined _MACOSX && !defined _MAC_SERVER)
282282
t_result -> driverref = (CFBundleRef)t_handle;
283+
#elif (defined _WINDOWS)
284+
t_result -> driverref = (HINSTANCE)t_handle;
283285
#else
284-
t_result -> driverref = t_handle;
286+
t_result -> driverref = t_handle;
285287
#endif
286288

287289
void *id_counterref_ptr, *new_connectionref_ptr, *release_connectionref_ptr;

0 commit comments

Comments
 (0)