Compare commits
3 Commits
c1cad88224
...
_old
| Author | SHA1 | Date | |
|---|---|---|---|
| 38b6137c38 | |||
| 1118ec3205 | |||
| a7abdbae57 |
Binary file not shown.
Binary file not shown.
@ -16,7 +16,7 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "interface/StreamReader.interface.inl"
|
#include "Interface/StreamReader.interface.inl"
|
||||||
|
|
||||||
namespace ia
|
namespace ia
|
||||||
{
|
{
|
||||||
|
|||||||
@ -1,16 +1,16 @@
|
|||||||
// IACore-OSS; The Core Library for All IA Open Source Projects
|
// IACore-OSS; The Core Library for All IA Open Source Projects
|
||||||
// Copyright (C) 2024 IAS (ias@iasoft.dev)
|
// Copyright (C) 2024 IAS (ias@iasoft.dev)
|
||||||
//
|
//
|
||||||
// This program is free software: you can redistribute it and/or modify
|
// This program is free software: you can redistribute it and/or modify
|
||||||
// it under the terms of the GNU General Public License as published by
|
// it under the terms of the GNU General Public License as published by
|
||||||
// the Free Software Foundation, either version 3 of the License, or
|
// the Free Software Foundation, either version 3 of the License, or
|
||||||
// (at your option) any later version.
|
// (at your option) any later version.
|
||||||
//
|
//
|
||||||
// This program is distributed in the hope that it will be useful,
|
// This program is distributed in the hope that it will be useful,
|
||||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
// GNU General Public License for more details.
|
// GNU General Public License for more details.
|
||||||
//
|
//
|
||||||
// You should have received a copy of the GNU General Public License
|
// You should have received a copy of the GNU General Public License
|
||||||
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
@ -19,11 +19,18 @@
|
|||||||
#include <IACore/Base.hpp>
|
#include <IACore/Base.hpp>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
||||||
|
#define REF_PTR_CLASS \
|
||||||
|
template<typename _value_type, typename... Args> friend INLINE RefPtr<_value_type> MakeRefPtr(Args &&...args) \
|
||||||
|
{ \
|
||||||
|
return std::make_shared<_value_type>(std::forward<Args>(args)...); \
|
||||||
|
}
|
||||||
|
|
||||||
namespace ia
|
namespace ia
|
||||||
{
|
{
|
||||||
template<typename _value_type>
|
template<typename _value_type> using RefPtr = std::shared_ptr<_value_type>;
|
||||||
using RefPtr = std::shared_ptr<_value_type>;
|
|
||||||
|
|
||||||
template<typename _value_type, typename... Args>
|
template<typename _value_type, typename... Args> INLINE RefPtr<_value_type> MakeRefPtr(Args &&...args)
|
||||||
INLINE RefPtr<_value_type> MakeRefPtr(Args... args) { return std::make_shared<_value_type>(args...); }
|
{
|
||||||
}
|
return std::make_shared<_value_type>(std::forward<Args>(args)...);
|
||||||
|
}
|
||||||
|
} // namespace ia
|
||||||
|
|||||||
@ -18,8 +18,8 @@
|
|||||||
|
|
||||||
#include "platform.inl"
|
#include "platform.inl"
|
||||||
|
|
||||||
#if (defined(IA_PLATFORM_WIN64) && (IA_PLATFORM_WIN64 > 0))
|
#if (defined(IA_CORE_PLATFORM_FEATUES) && (IA_CORE_PLATFORM_FEATUES > 0))
|
||||||
#include "win/environment.inl"
|
#if (defined(IA_PLATFORM_WIN64) && (IA_PLATFORM_WIN64 > 0))
|
||||||
#else
|
#include "win/environment.inl"
|
||||||
#error "IACore Unsupported Platform"
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@ -132,4 +132,11 @@ namespace ia
|
|||||||
{
|
{
|
||||||
std::this_thread::sleep_for(std::chrono::milliseconds(milliseconds));
|
std::this_thread::sleep_for(std::chrono::milliseconds(milliseconds));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if (defined(IA_PLATFORM_WIN64) && (IA_PLATFORM_WIN64 > 0))
|
||||||
|
#define IA_CORE_PLATFORM_FEATUES 1
|
||||||
|
#else
|
||||||
|
#define IA_CORE_PLATFORM_FEATUES 0
|
||||||
|
#warning "IACore Unsupported Platform: Platform specific features will be disabled"
|
||||||
|
#endif
|
||||||
@ -18,8 +18,8 @@
|
|||||||
|
|
||||||
#include "platform.inl"
|
#include "platform.inl"
|
||||||
|
|
||||||
#if (defined(IA_PLATFORM_WIN64) && (IA_PLATFORM_WIN64 > 0))
|
#if (defined(IA_CORE_PLATFORM_FEATUES) && (IA_CORE_PLATFORM_FEATUES > 0))
|
||||||
#include "win/process.inl"
|
#if (defined(IA_PLATFORM_WIN64) && (IA_PLATFORM_WIN64 > 0))
|
||||||
#else
|
#include "win/process.inl"
|
||||||
#error "IACore Unsupported Platform"
|
#endif
|
||||||
#endif
|
#endif
|
||||||
@ -35,12 +35,14 @@ namespace ia
|
|||||||
|
|
||||||
INLINE ~DynamicLib();
|
INLINE ~DynamicLib();
|
||||||
|
|
||||||
|
INLINE VOID Destroy();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
INLINE PVOID GetSymbol(IN CONST String &name);
|
INLINE PVOID GetSymbol(IN CONST String &name);
|
||||||
|
|
||||||
template<typename FunctionType> FunctionType GetFunction(IN CONST String &name)
|
template<typename FunctionType> FunctionType GetFunction(IN CONST String &name)
|
||||||
{
|
{
|
||||||
return reinterpret_cast<FunctionType *>(GetSymbol(name));
|
return reinterpret_cast<FunctionType>(GetSymbol(name));
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
@ -57,6 +59,10 @@ namespace ia
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
DynamicLib::~DynamicLib()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
#if defined(_WIN32)
|
#if defined(_WIN32)
|
||||||
DynamicLib DynamicLib::Load(IN CONST String &searchPath, IN CONST String &name)
|
DynamicLib DynamicLib::Load(IN CONST String &searchPath, IN CONST String &name)
|
||||||
{
|
{
|
||||||
@ -66,12 +72,6 @@ namespace ia
|
|||||||
return DynamicLib((PVOID) handle);
|
return DynamicLib((PVOID) handle);
|
||||||
}
|
}
|
||||||
|
|
||||||
DynamicLib::~DynamicLib()
|
|
||||||
{
|
|
||||||
if (m_moduleHandle)
|
|
||||||
FreeLibrary(static_cast<HMODULE>(m_moduleHandle));
|
|
||||||
}
|
|
||||||
|
|
||||||
PVOID DynamicLib::GetSymbol(IN CONST String &name)
|
PVOID DynamicLib::GetSymbol(IN CONST String &name)
|
||||||
{
|
{
|
||||||
const auto symbol = GetProcAddress(static_cast<HMODULE>(m_moduleHandle), name.c_str());
|
const auto symbol = GetProcAddress(static_cast<HMODULE>(m_moduleHandle), name.c_str());
|
||||||
@ -79,6 +79,12 @@ namespace ia
|
|||||||
THROW_UNKNOWN("DynamicLib: Failed to find the symbol \"", name, "\" with error: ", GetLastError());
|
THROW_UNKNOWN("DynamicLib: Failed to find the symbol \"", name, "\" with error: ", GetLastError());
|
||||||
return (PVOID) symbol;
|
return (PVOID) symbol;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
VOID DynamicLib::Destroy()
|
||||||
|
{
|
||||||
|
if (m_moduleHandle)
|
||||||
|
FreeLibrary(static_cast<HMODULE>(m_moduleHandle));
|
||||||
|
}
|
||||||
#else
|
#else
|
||||||
DynamicLib DynamicLib::Load(IN CONST String &searchPath, IN CONST String &name)
|
DynamicLib DynamicLib::Load(IN CONST String &searchPath, IN CONST String &name)
|
||||||
{
|
{
|
||||||
@ -89,20 +95,20 @@ namespace ia
|
|||||||
return DynamicLib((PVOID) handle);
|
return DynamicLib((PVOID) handle);
|
||||||
}
|
}
|
||||||
|
|
||||||
DynamicLib::~DynamicLib()
|
PVOID DynamicLib::GetSymbol(IN CONST String &name)
|
||||||
|
{
|
||||||
|
dlerror();
|
||||||
|
const auto symbol = dlsym(m_moduleHandle, name.c_str());
|
||||||
|
const char *dlsym_error = dlerror();
|
||||||
|
if (dlsym_error)
|
||||||
|
THROW_UNKNOWN("DynamicLib: Failed to find the symbol \"", name, "\" with error: ", dlerror());
|
||||||
|
return (PVOID) symbol;
|
||||||
|
}
|
||||||
|
|
||||||
|
VOID DynamicLib::Destroy()
|
||||||
{
|
{
|
||||||
if (m_moduleHandle)
|
if (m_moduleHandle)
|
||||||
dlclose(m_moduleHandle);
|
dlclose(m_moduleHandle);
|
||||||
}
|
}
|
||||||
|
|
||||||
PVOID DynamicLib::GetSymbol(IN CONST String &name)
|
|
||||||
{
|
|
||||||
dlerror();
|
|
||||||
const auto symbol = dlsym(handle, name.c_str());
|
|
||||||
const char *dlsym_error = dlerror();
|
|
||||||
if (dlsym_error)
|
|
||||||
THROW_UNKNOWN("DynamicLib: Failed to find the symbol \"", name, "\" with error: ", dlerror());
|
|
||||||
return (PVOID)symbol;
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
} // namespace ia
|
} // namespace ia
|
||||||
@ -30,9 +30,9 @@ int main(int argc, char *argv[])
|
|||||||
SubProcess p("clang++");
|
SubProcess p("clang++");
|
||||||
p.Launch("a.cpp", [](IN CONST String &line) { printf("[\n%s\n]\n", line.c_str()); });*/
|
p.Launch("a.cpp", [](IN CONST String &line) { printf("[\n%s\n]\n", line.c_str()); });*/
|
||||||
|
|
||||||
printf("[%s]\n", Environment::GetVar("IAEDK_ROOT").c_str());
|
//printf("[%s]\n", Environment::GetVar("IAEDK_ROOT").c_str());
|
||||||
Environment::SetVar("IAEDK_ROOT", "C:\\IAEDK");
|
//Environment::SetVar("IAEDK_ROOT", "C:\\IAEDK");
|
||||||
printf("[%s]\n", Environment::GetVar("IAEDK_ROOT").c_str());
|
//printf("[%s]\n", Environment::GetVar("IAEDK_ROOT").c_str());
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user