Skip to content

Commit

Permalink
Fixed dllimport issue
Browse files Browse the repository at this point in the history
  • Loading branch information
AdventureT committed Jan 1, 2024
1 parent 60cb76e commit 32806fd
Show file tree
Hide file tree
Showing 39 changed files with 268 additions and 70 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@
#define TOSHI_MULTIPLATFORM(FILENAME) STRINGIFY(STRCAT_3(Win/, FILENAME, Win.h))
#endif

#ifdef TOSHI_USER_ENGINE
#define TOSHI_EXPORT __declspec(dllexport)
#ifdef TAPPLICATION
#define TAPPLICATION_EXPORTS __declspec(dllexport)
#else
#define TOSHI_EXPORT __declspec(dllimport)
#define TAPPLICATION_EXPORTS __declspec(dllimport)
#endif

#define TOSHI_API __stdcall
Expand Down
3 changes: 2 additions & 1 deletion Toshi/Include/TApplication/TApplication.h
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
#pragma once
#include "TKernel/TKernelInterface.h"
#include "Defines.h"
#include <windows.h>

TOSHI_NAMESPACE_BEGIN

class TOSHI_EXPORT TApplication
class TAPPLICATION_EXPORTS TApplication
{

private:
Expand Down
64 changes: 64 additions & 0 deletions Toshi/Include/TKernel/Defines.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
#pragma once

#define TNULL nullptr
#define TFALSE false
#define TTRUE true
#define BITFIELD(x) (1 << x)

#if defined(TOSHI_RELEASE) || defined(TOSHI_DEBUG)
#define TOSHI_NOTFINAL
#endif

#define STRINGIFY2(X) #X
#define STRINGIFY(X) STRINGIFY2(X)

#define STRCAT2(X, Y) X##Y
#define STRCAT(X, Y) STRCAT2(X, Y)
#define STRCAT_2 CAT
#define STRCAT_3(X, Y, Z) STRCAT(X, STRCAT(Y, Z))
#define STRCAT_4(A, X, Y, Z) STRCAT(A, STRCAT_3(X, Y, Z))

#define HASFLAG(flag) (flag) != 0

#ifdef TOSHI_SKU_WINDOWS
#define TOSHI_MULTIPLATFORM(FILENAME) STRINGIFY(STRCAT_3(Win/, FILENAME, Win.h))
#endif

#ifdef TKERNELINTERFACE
#define TKERNELINTERFACE_EXPORTS __declspec(dllexport)
#else
#define TKERNELINTERFACE_EXPORTS __declspec(dllimport)
#endif

#define TOSHI_API __stdcall
#define TOSHI_CALLBACKAPI __cdecl

#define TOSHI_NAMESPACE_BEGIN namespace Toshi {
#define TOSHI_NAMESPACE_END }
#define TOSHI_NAMESPACE_USING using namespace Toshi;

#define TSTATICCAST(type, value) static_cast<type>(value)

#define _TS8(str) #str

typedef bool TBOOL;
typedef int TINT;
typedef unsigned int TUINT;
typedef unsigned int TUINT32;
typedef unsigned __int64 TUINT64;
typedef short TSHORT;
typedef unsigned short TUSHORT;
typedef wchar_t TWCHAR;
typedef unsigned short* TPWCHAR;
typedef const char* TPCCHAR;
typedef char* TPCHAR;
typedef char TCHAR;
typedef const char TCCHAR;
typedef char TINT8;
typedef unsigned char TUINT8;
typedef unsigned char TBYTE;
typedef unsigned char* TPBYTE;
typedef void* TPVOID;
typedef const void* TPCVOID;
typedef float TFLOAT;
typedef const float TCFLOAT;
2 changes: 1 addition & 1 deletion Toshi/Include/TKernel/TCString.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

TOSHI_NAMESPACE_BEGIN

class TOSHI_EXPORT TCString
class TKERNELINTERFACE_EXPORTS TCString
{
public:

Expand Down
2 changes: 1 addition & 1 deletion Toshi/Include/TKernel/TDLL.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

TOSHI_NAMESPACE_BEGIN

class TOSHI_EXPORT TDLL
class TKERNELINTERFACE_EXPORTS TDLL
{
public:

Expand Down
4 changes: 2 additions & 2 deletions Toshi/Include/TKernel/TDList.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@

TOSHI_NAMESPACE_BEGIN

class TOSHI_EXPORT TGenericDList
class TKERNELINTERFACE_EXPORTS TGenericDList
{
public:
class TOSHI_EXPORT TNode
class TKERNELINTERFACE_EXPORTS TNode
{
protected:

Expand Down
26 changes: 13 additions & 13 deletions Toshi/Include/TKernel/TDebug.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ enum TDebug_Flags : TUINT
FLAG_UNK3 = BITFIELD(2)
};

class TOSHI_EXPORT TDebug
class TKERNELINTERFACE_EXPORTS TDebug
{
public:

Expand All @@ -57,22 +57,22 @@ class TOSHI_EXPORT TDebug

};

void TOSHI_EXPORT TOSHI_API TDebug_VPrintfDirect(TUINT a_uiFlags, TPCCHAR a_pcFormat, va_list a_vargs);
void TKERNELINTERFACE_EXPORTS TOSHI_API TDebug_VPrintfDirect(TUINT a_uiFlags, TPCCHAR a_pcFormat, va_list a_vargs);

void TOSHI_EXPORT TOSHI_API TDebug_VPrintf(TUINT a_uiFlags, TPCCHAR a_pcFormat, va_list a_vargs);
void TKERNELINTERFACE_EXPORTS TOSHI_API TDebug_VPrintf(TUINT a_uiFlags, TPCCHAR a_pcFormat, va_list a_vargs);

void TOSHI_EXPORT TOSHI_CALLBACKAPI TDebug_Printf(TPCCHAR a_pcFormat, ...);
void TOSHI_EXPORT TOSHI_CALLBACKAPI TDebug_Printf(TUINT a_uiFlags, TPCCHAR a_pcFormat, ...);
void TKERNELINTERFACE_EXPORTS TOSHI_CALLBACKAPI TDebug_Printf(TPCCHAR a_pcFormat, ...);
void TKERNELINTERFACE_EXPORTS TOSHI_CALLBACKAPI TDebug_Printf(TUINT a_uiFlags, TPCCHAR a_pcFormat, ...);

void TOSHI_EXPORT TOSHI_CALLBACKAPI TDebug_PrintfDirect(TPCCHAR a_pcFormat, ...);
void TOSHI_EXPORT TOSHI_CALLBACKAPI TDebug_PrintfDirect(TUINT a_uiFlags, TPCCHAR a_pcFormat, ...);
void TKERNELINTERFACE_EXPORTS TOSHI_CALLBACKAPI TDebug_PrintfDirect(TPCCHAR a_pcFormat, ...);
void TKERNELINTERFACE_EXPORTS TOSHI_CALLBACKAPI TDebug_PrintfDirect(TUINT a_uiFlags, TPCCHAR a_pcFormat, ...);

void TOSHI_EXPORT TOSHI_CALLBACKAPI TDebug_CPrintf(TINT a_iFlags, TPCCHAR a_pcFormat, ...);
void TKERNELINTERFACE_EXPORTS TOSHI_CALLBACKAPI TDebug_CPrintf(TINT a_iFlags, TPCCHAR a_pcFormat, ...);

void TOSHI_EXPORT TOSHI_CALLBACKAPI TDebug_Message(TDebug::MSGLEVEL a_eMsgLevel, TPCCHAR a_pcFormat, ...);
void TKERNELINTERFACE_EXPORTS TOSHI_CALLBACKAPI TDebug_Message(TDebug::MSGLEVEL a_eMsgLevel, TPCCHAR a_pcFormat, ...);

void TOSHI_EXPORT TOSHI_CALLBACKAPI TDebug_PrintError(TPCCHAR a_pcFormat, ...);
void TOSHI_EXPORT TOSHI_CALLBACKAPI TDebug_PrintWarning(TPCCHAR a_pcFormat, ...);
void TKERNELINTERFACE_EXPORTS TOSHI_CALLBACKAPI TDebug_PrintError(TPCCHAR a_pcFormat, ...);
void TKERNELINTERFACE_EXPORTS TOSHI_CALLBACKAPI TDebug_PrintWarning(TPCCHAR a_pcFormat, ...);


TOSHI_NAMESPACE_END
Expand All @@ -96,7 +96,7 @@ enum TDebug_Flags : TUINT
FLAG_UNK3 = BITFIELD(2)
};

class TOSHI_EXPORT TDebug
class TKERNELINTERFACE_EXPORTS TDebug
{
public:

Expand All @@ -119,7 +119,7 @@ class TOSHI_EXPORT TDebug

};

void TOSHI_EXPORT TOSHI_CALLBACKAPI TDebug_Message(TDebug::MSGLEVEL a_eMsgLevel, TPCCHAR a_pcFormat, ...);
void TKERNELINTERFACE_EXPORTS TOSHI_CALLBACKAPI TDebug_Message(TDebug::MSGLEVEL a_eMsgLevel, TPCCHAR a_pcFormat, ...);

TOSHI_NAMESPACE_END

Expand Down
6 changes: 3 additions & 3 deletions Toshi/Include/TKernel/TFile.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ TOSHI_NAMESPACE_BEGIN

class TFile;

class TOSHI_EXPORT TFileSystem : public TDList<TFileSystem>::TNode
class TKERNELINTERFACE_EXPORTS TFileSystem : public TDList<TFileSystem>::TNode
{
public:
TFileSystem(TPCCHAR a_pcName) : TNode()
Expand Down Expand Up @@ -53,7 +53,7 @@ class TOSHI_EXPORT TFileSystem : public TDList<TFileSystem>::TNode
TCString m_sPrefix; // 0xC
};

class TOSHI_EXPORT TFileManager
class TKERNELINTERFACE_EXPORTS TFileManager
{
public:
class TSysPathIter
Expand Down Expand Up @@ -145,7 +145,7 @@ enum TMODE : TUINT
TMODE_NOBUFFER = BITFIELD(4)
};

class TOSHI_EXPORT TFile
class TKERNELINTERFACE_EXPORTS TFile
{
protected:
TFile(TFileSystem* a_pFileSystem)
Expand Down
4 changes: 2 additions & 2 deletions Toshi/Include/TKernel/TFreeList.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@

TOSHI_NAMESPACE_BEGIN

class TOSHI_EXPORT TFreeList
class TKERNELINTERFACE_EXPORTS TFreeList
{
public:
struct TOSHI_EXPORT Node
struct TKERNELINTERFACE_EXPORTS Node
{
friend class TFreeList;
public:
Expand Down
2 changes: 1 addition & 1 deletion Toshi/Include/TKernel/THPTimer.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

TOSHI_NAMESPACE_BEGIN

class TOSHI_EXPORT THPTimer
class TKERNELINTERFACE_EXPORTS THPTimer
{
public:
THPTimer();
Expand Down
2 changes: 1 addition & 1 deletion Toshi/Include/TKernel/TKernelInterface.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

TOSHI_NAMESPACE_BEGIN

class TOSHI_EXPORT TKernelInterface : public TObject
class TKERNELINTERFACE_EXPORTS TKernelInterface : public TObject
{
DECLARE_DYNAMIC(TKernelInterface);
public:
Expand Down
4 changes: 2 additions & 2 deletions Toshi/Include/TKernel/TLString.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@

TOSHI_NAMESPACE_BEGIN

class TOSHI_EXPORT TLocale
class TKERNELINTERFACE_EXPORTS TLocale
{
public:
static int const TEMP_START_INDEX = 0x40000000;
};

class TOSHI_EXPORT TLocalisedString
class TKERNELINTERFACE_EXPORTS TLocalisedString
{
public:
static TFreeList& TOSHI_API GetFreeList() { return m_oFreelist; }
Expand Down
8 changes: 4 additions & 4 deletions Toshi/Include/TKernel/TMemory.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ inline static Toshi::TMutex* g_pMutex = TNULL;

TOSHI_NAMESPACE_BEGIN

class TOSHI_EXPORT TMemory
class TKERNELINTERFACE_EXPORTS TMemory
{

struct HALMemInfo
Expand Down Expand Up @@ -76,6 +76,6 @@ inline static TMemory g_oMemManager;

TOSHI_NAMESPACE_END

TPVOID TOSHI_EXPORT TOSHI_API tmalloc(TINT a_iSize, TPCHAR a_pBuffer, TINT a_iUnk);
TPVOID TOSHI_EXPORT TOSHI_API tmemalign(TINT a_iAlign, TINT a_iSize);
void TOSHI_EXPORT TOSHI_API tfree(TPVOID a_pMem);
TPVOID TKERNELINTERFACE_EXPORTS TOSHI_API tmalloc(TINT a_iSize, TPCHAR a_pBuffer, TINT a_iUnk);
TPVOID TKERNELINTERFACE_EXPORTS TOSHI_API tmemalign(TINT a_iAlign, TINT a_iSize);
void TKERNELINTERFACE_EXPORTS TOSHI_API tfree(TPVOID a_pMem);
2 changes: 1 addition & 1 deletion Toshi/Include/TKernel/TNTree.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

TOSHI_NAMESPACE_BEGIN

class TOSHI_EXPORT TGenericNTree
class TKERNELINTERFACE_EXPORTS TGenericNTree
{
class TNode
{
Expand Down
6 changes: 3 additions & 3 deletions Toshi/Include/TKernel/TNodeList.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@

TOSHI_NAMESPACE_BEGIN

class TOSHI_EXPORT TGenericNodeList
class TKERNELINTERFACE_EXPORTS TGenericNodeList
{
public:
class TOSHI_EXPORT TNode
class TKERNELINTERFACE_EXPORTS TNode
{
friend class TGenericNodeList;
public:
Expand Down Expand Up @@ -70,7 +70,7 @@ class TOSHI_EXPORT TGenericNodeList
TNode* m_pPrev; // 0x8
};

class TOSHI_EXPORT Iterator
class TKERNELINTERFACE_EXPORTS Iterator
{
public:

Expand Down
4 changes: 2 additions & 2 deletions Toshi/Include/TKernel/TObject.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ typedef TBOOL (*t_RecurceTreeBaseEndCb)(class TClass*, TPCVOID);
#define TGetClass(X) X::m_sClass
#define TFindClass(X, Y) Toshi::TClass::Find(#X, Y)

class TOSHI_EXPORT TClass
class TKERNELINTERFACE_EXPORTS TClass
{
public:
TClass(TPCCHAR a_pcName, TClass* a_pParent, t_CreateTObject a_Create, t_CreateTObjectInPlace a_CreateInPlace, t_InitializeStatic a_Init, t_UninitializeStatic a_Uninit, TUINT a_uiVersion);
Expand Down Expand Up @@ -133,7 +133,7 @@ private: \
{ TASSERT(!"This class does not support dynamic creation!"); return TNULL; } \
IMPLEMENT_RUNTIMECLASS(class_name, base_class_name, class_name::CreateObject, class_name::CreateObjectInPlace, 1)

class TOSHI_EXPORT TObject
class TKERNELINTERFACE_EXPORTS TObject
{
private:
static TObject* TOSHI_API CreateObject()
Expand Down
2 changes: 1 addition & 1 deletion Toshi/Include/TKernel/TPCString.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

TOSHI_NAMESPACE_BEGIN

class TOSHI_EXPORT TPCString
class TKERNELINTERFACE_EXPORTS TPCString
{

};
Expand Down
2 changes: 1 addition & 1 deletion Toshi/Include/TKernel/TProfiler.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

TOSHI_NAMESPACE_BEGIN

class TOSHI_EXPORT TProfiler
class TKERNELINTERFACE_EXPORTS TProfiler
{
public:
void Start();
Expand Down
2 changes: 1 addition & 1 deletion Toshi/Include/TKernel/TScheduler.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ TOSHI_NAMESPACE_BEGIN

class TKernelInterface;

class TOSHI_EXPORT TScheduler : public TObject
class TKERNELINTERFACE_EXPORTS TScheduler : public TObject
{
DECLARE_DYNAMIC(TScheduler);
public:
Expand Down
2 changes: 1 addition & 1 deletion Toshi/Include/TKernel/TSystemTools.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

TOSHI_NAMESPACE_BEGIN

class TOSHI_EXPORT TSystem
class TKERNELINTERFACE_EXPORTS TSystem
{
public:

Expand Down
2 changes: 1 addition & 1 deletion Toshi/Include/TKernel/TTask.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ TOSHI_NAMESPACE_BEGIN

class TScheduler;

class TOSHI_EXPORT TTask : public TObject, public TNodeTree<TTask>::TNode
class TKERNELINTERFACE_EXPORTS TTask : public TObject, public TNodeTree<TTask>::TNode
{
DECLARE_DYNAMIC(TTask);

Expand Down
2 changes: 1 addition & 1 deletion Toshi/Include/TKernel/TThread.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

TOSHI_NAMESPACE_BEGIN

class TOSHI_EXPORT TMutexLock
class TKERNELINTERFACE_EXPORTS TMutexLock
{
public:

Expand Down
4 changes: 2 additions & 2 deletions Toshi/Include/TKernel/TUser.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

TOSHI_NAMESPACE_BEGIN

class TOSHI_EXPORT TUser
class TKERNELINTERFACE_EXPORTS TUser
{
friend class TUserHandler;
public:
Expand All @@ -26,7 +26,7 @@ class TOSHI_EXPORT TUser
TSHORT m_iUserID; // 0x6
};

class TOSHI_EXPORT TUserHandler
class TKERNELINTERFACE_EXPORTS TUserHandler
{
protected:
TUserHandler();
Expand Down
Loading

0 comments on commit 32806fd

Please sign in to comment.