Actually 2 questions, but let's start with the more global one; is it a good idea to put math functionality in a separate library (Windows DLL) - performance wise?
I'm trying to split up my huge game application into smaller chunks, DLL's. One of those chunks would be a generic math library, with mainly vector functions. Now normally I don't care tóóó much about performance, but vector-functions are called LOT's of times each cycle. And if I remember well -but correct me if I'm wrong!- calling a function from an external library adds a little bit overhead.
So Instead of calling DLL functions, I could just as well just attach the code files to my other libraries that make use of it, if performance is really an issue. But I found the DLL way more elegant. The smaller each library, the better maintainable. Any idea how modern game engines handle this?
For the info- I'm making this math library with either native C++ or Pascal (Delphi XE). Thus not .NET or the likes.
Second, and this might be a bit C++ or Delphi specific, I'd like to keep things OOP. Now with .NET you can import a DLL and use its classes. But if I'm right this is not (directly) possible with C++ or Delphi based libraries. AFAIK, you can only export functions, structs (with functions / operator overloading??), and "Interfaces".
The latter, Interfaces, would more or less allow to export an "object" with functions. But yet again, I'm not sure if this is wise to do, when caring about performance. A typical example would be sharing "Entities" amongst multiple DLL's. An entity could be a game object, such as the player, a lightsource, or a crate. Several DLL's could be interested in using (read looping through / reading / writing / calling a lot) these entities. AI, Rendering, Physics, Game-rules , ...