mirror of
https://github.com/bkaradzic/bx.git
synced 2026-02-18 04:53:06 +01:00
Fixed build.
This commit is contained in:
@@ -38,12 +38,9 @@ namespace bx
|
||||
template<class Ty>
|
||||
constexpr bool isTriviallyCopyable();
|
||||
|
||||
///
|
||||
typedef void (*AnyFn)(void);
|
||||
|
||||
///
|
||||
template<typename ProtoT>
|
||||
constexpr ProtoT functionCast(AnyFn _fn);
|
||||
constexpr ProtoT functionCast(void* _fn);
|
||||
|
||||
/// Swap two values.
|
||||
template<typename Ty>
|
||||
|
||||
@@ -34,7 +34,7 @@ namespace bx
|
||||
}
|
||||
|
||||
template<typename ProtoT>
|
||||
inline constexpr ProtoT functionCast(AnyFn _fn)
|
||||
inline constexpr ProtoT functionCast(void* _fn)
|
||||
{
|
||||
return reinterpret_cast<ProtoT>(_fn);
|
||||
}
|
||||
|
||||
18
include/bx/inline/os.inl
Normal file
18
include/bx/inline/os.inl
Normal file
@@ -0,0 +1,18 @@
|
||||
/*
|
||||
* Copyright 2010-2020 Branimir Karadzic. All rights reserved.
|
||||
* License: https://github.com/bkaradzic/bx#license-bsd-2-clause
|
||||
*/
|
||||
|
||||
#ifndef BX_H_HEADER_GUARD
|
||||
# error "Must be included from bx/os.h!"
|
||||
#endif // BX_H_HEADER_GUARD
|
||||
|
||||
namespace bx
|
||||
{
|
||||
template<typename ProtoT>
|
||||
inline ProtoT dlsym(void* _handle, const StringView& _symbol)
|
||||
{
|
||||
return reinterpret_cast<ProtoT>(dlsym(_handle, _symbol) );
|
||||
}
|
||||
|
||||
} // namespace bx
|
||||
@@ -40,6 +40,10 @@ namespace bx
|
||||
///
|
||||
void* dlsym(void* _handle, const StringView& _symbol);
|
||||
|
||||
///
|
||||
template<typename ProtoT>
|
||||
ProtoT dlsym(void* _handle, const StringView& _symbol);
|
||||
|
||||
///
|
||||
bool getEnv(char* _out, uint32_t* _inOutSize, const StringView& _name);
|
||||
|
||||
@@ -54,4 +58,6 @@ namespace bx
|
||||
|
||||
} // namespace bx
|
||||
|
||||
#include "inline/os.inl"
|
||||
|
||||
#endif // BX_OS_H_HEADER_GUARD
|
||||
|
||||
@@ -280,10 +280,9 @@ namespace bx
|
||||
#elif BX_PLATFORM_WINDOWS
|
||||
// Try to use the new thread naming API from Win10 Creators update onwards if we have it
|
||||
typedef HRESULT (WINAPI *SetThreadDescriptionProc)(HANDLE, PCWSTR);
|
||||
SetThreadDescriptionProc SetThreadDescription = functionCast<SetThreadDescriptionProc>(
|
||||
dlsym(GetModuleHandleA("Kernel32.dll"), "SetThreadDescription")
|
||||
);
|
||||
if (SetThreadDescription)
|
||||
SetThreadDescriptionProc SetThreadDescription = dlsym<SetThreadDescriptionProc>((void*)GetModuleHandleA("Kernel32.dll"), "SetThreadDescription");
|
||||
|
||||
if (NULL != SetThreadDescription)
|
||||
{
|
||||
uint32_t length = (uint32_t)bx::strLen(_name)+1;
|
||||
uint32_t size = length*sizeof(wchar_t);
|
||||
|
||||
Reference in New Issue
Block a user