Recap
My last dev log was showing my progress of developing my SDK data type library, however after using that I noticed a lot of issues with it and decided to scrap it all together for now, I will explain why during this section.
I also decided to scrap my entire project and start again. The reason for this is that I was using premake5
as my build system and had a lot of issues with visual studio and getting everything working how I wanted. So I decided you know what I don’t need a build system I can just setup the project configuration on each platform that I need when I need to develop for it.
So, as for my data type library. I had issues with cross compatibility with using windows.h
function data types which causes so much frustration and headaches I decided to just scrap it for now and focus on what matters, until I gain the knowledge and ability to create this library without these issues.
One of the reasons for making this decision to scrap my current work and start again was due to the fact that I could not get pre-compiled headers to work and link correctly using premake
it constantly created more issues with my code and I just decided to do it all manually as it would be faster.
Lastly I realised that I should focus on making my code work before making it look pretty and efficient. So I actually realised the hard way that instead of spending months working on the little things I should just spend some time getting a working version of my project using the standard library in C++ and then one day once I have everything up and running and working I can go back and replace the standard library functionality with my own custom stuff which will also allow for better testing and ensuring it meets the exact requirements instead of guessing and having issues like I did with my data type library. It was not tested in the real application until too late and failed which resulted in taking too much time to fix or just scrap for now.
Todays Objectives
Today I plan to get my entire project setup manually using Visual Stduio 2022 on Windows 64-bit. To do this I need to complete the following objectives:
- Create a Shared Library Project
- Create a TestLab App Project
- Create a Custom Configuration
- Create a Pre-Build Step for TestLab
- Create the Core Application Class
Progress
Setting Up the Initial Projects
ELBZ DLL Project
The first project I setup was ELBZ my shared library project which will power all software built with ELBZ.
TestLab Application Project
Next I created the TestLab Project which is an application that will allow me to test my ELBZ Library by calling functions and simulating usage of the SDK.
Setting Up the Core API Logic
Inside of the Core file will be all the core logic related to the SDK. This includes the API Define for determining if we should be exporting or importing a dll function/class.
ELBZ Project – Test.hpp
__declspec(dllexport) void Print();
TestLab Project – Main.cpp
__declspec(dllimport) void Print();
int main() {
Print();
return 0;
}
As you can see these two files show how in each project I access and use a function.
Now for my API Define – this is used to automatically decide if I need to import or export the function when including the header file form ELBZ.
Core.hpp
#pragma once
#ifdef ELBZ_DEF_PLATFORM_WIN64
#ifdef ELBZ_DEF_OUT_TYPE_DLL
#define ELBZ_API __declspec(dllexport)
#else
#define ELBZ_API __declspec(dllimport)
#endif
#else
#error ELBZ Only Supports Win64
#endif
ELBZ Project – Usage.hpp
#pragma once
#include "Core.hpp"
class ELBZ_API Test {
public:
void Print();
};
TestLab Project – Main.hpp
#include <ELBZ.hpp>
int main() {
Print();
return 0;
}
Creating the Entry Point
For the entry point I made my life a little easier I used a popular approach for this where the dll
handles the runtime definition using a pointer to the function inside of the TestLab project to run the application here let me show you what I mean.
ELBZ Project – EntryPoint.hpp
extern Application* NewApp();
int main(int argc, char** argv) {
Application* app = NewApp();
app->Run();
delete app;
}
TestLab Project – App.cpp
#include <ELBZ.hpp>
class TestLab : public Application
{
TestLab()
{
}
~TestLab()
{
}
};
Application* NewApp()
{
return new TestLab();
}
This here is a very common approach and I will be planning to change this later on as I have another idea of how I would like people to use the SDK to create an entry point, but for now this will stay like it is probably for a while as my plan is to just get everything working and then go back later and fix all the things that are ugly or not optimised enough.
Final Thoughts
Conclusion
After implementing all of this I am very happy to continue and build the next stage in this project. I am very excited for this project and I understand completely that a lot of this setup stuff before we get to rendering graphics will be similar to other software structures out there but my objective is to get things working as early as possible and then go back and change the structure if I need to for a more efficient one. So please be patient and hopefully we will have a working version of this SDK that we can use to develop some incredibly applications very soon.
Tomorrows Objectives
- Create a Window using
Windows.h
- Setup an OpenGl Render Context with the Window
- Link the OpenGL Library
- Implement Glew for linking to modern OpenGl Usage
Feedback
If you do have any feedback or ideas you would like to discuss please feel free to contact me via an-means of communication through my socials I will respond as fast as I can.
Contact & Other Socials
https://www.instagram.com/estrolabz/
https://www.patreon.com/c/ESTROLABZ
https://www.youtube.com/@estrolabzuk
https://www.reddit.com/r/ESTROLABZ/
https://autumn-oboe-c16.notion.site/ESTROLABZ-Blog-237763e1ef908090a5fec3ea8c04331e?source=copy_link