I am working on a 3d game engine which requires some maths, but i want to modulate my code better by putting the math into a library. Right now im using a header file called “DataTypes.hpp” which has all structures and datatypes my engine needs. This also includes my math files, “VMMath.hpp” (this serves as a wrapper) and within here i include four other header files for my vector, matrix and quaternion classes.
My approach being i want DataTypes to be become a precompiled header, and the VMMath code to be a library (static or dll, ill be honest im not sure which). As then i dont have to put the DataType header in all the VMMath sources, and reduce the relevant source files for the project.
From what i have seen a library must be one header and source, which uses extern or static keywords so the header can use the methods in the source. The example on MSDN shows a class in a namespace with no constructors/destructors with static methods. But i find it abit short to really show you what its capable of.
So is it possible to create a library from this sort of file structure:
<-Project Dir->
-
(other sources/folders)
-
VMMath
— VMMath.hpp
-
Math
— CVector2.hpp
— CVector2.cpp
— CPoint2.hpp
— CVector3.hpp
— CVector3.cpp
— CPoint3.hpp
— CVector4.hpp
— CVector4.cpp
— CMatrix3.hpp
— CMatrix3.cpp
— CMatrix4.hpp
— CMatrix4.cpp
— CQuaternion.hpp
— CQuaternion.cpp
-
I hope that makes sense. So one way i can see this working is having VMMath.hpp have ALL classes inside, and VMMath.cpp containing ALL the classes source, but this isnt very maintainable. Or would i have to make each class as a seperate dll?
Here is an article from codeproject i have read but it doesn’t show a dll with multiple files : http://www.codeproject.com/Articles/6351/Regular-DLL-Tutor-For-Beginners
I hope ive made my self clear, appologies if i have generated too much reading.
There is no restriction on the number of header or source files for any kind of library.