I have a question. I'm not sure I am using the right terms or anything here, but, I have seen people develop their "projects" (classes etc..) and then creating a .dll file (or .lib) and then importing the files when they need them. But I cannot seem to get my head around it.. So for example:

Featured Replies in this Discussion

... is a pretty complete tutorial for Linux. For Mac, it is a Unix-like system like Linux, and so, the tutorial is equally valid for Mac. ... You have wrong, here is how it is: Windows: ... : for "Dynamic-Link Library", the DLL is needed to run the executable (i.e., the library code is in the DLL only, not imported into the executable, and that code is loaded dynamically (when loading the executable)). ... :…

... You'd have two builds for the two systems. Whether the actual code that gets built needs to be ported to support the different systems depends on what you're doing. That also dictates how hard it is, but it could be as simple as just rebuilding with a different target (if the code is 100% standard C++, which is portable) to anywhere as hard as rewriting the whole thing (if you use a lot of…

Windows:.dll : for "Dynamic-Link Library", the DLL is needed to run the executable (i.e., the library code is in the DLL only, not imported into the executable, and that code is loaded dynamically (when loading the executable))..lib : for static library (only used by Microsoft and Borland compilers), the lib is only needed when compiling the executable (i.e., the library code is imported into the final executable, making it a standalone executable).

Unix-like systems (Unix, QNX, Linux, Mac, Windows/Cygwin, and just about every other OS that exists today):lib***.so : for "Shared Object", this is essentially the same as a Windows DLL (although the linking mechanisms are a bit different, but that's an advanced topic).lib***.a : for "Archive" or also called a static library, this is the same as a .lib, but for all compilers other than Microsoft or Borland (i.e., GCC / Clang / ICC / ... under Windows also use .a for static libraries). The only difference between a .lib and a .a is the binary format used (the .a files use the ELF (POSIX) standard from Unix).

Thanks for this, really helped me and I can now finally start building my library.

Quick question though -

I understand the differences between (.lib and .dll) BUT how difficult would it be to have a .lib and a .dll file so I can work with both Linux/Unix and Windows? So in theory, if my library was called "HelloWorld" I could have: "HelloWorld.lib" -- linux and "HelloWorld.dll" - Windows

how difficult would it be to have a .lib and a .dll file so I can work with both Linux/Unix and Windows?

You'd have two builds for the two systems. Whether the actual code that gets built needs to be ported to support the different systems depends on what you're doing. That also dictates how hard it is, but it could be as simple as just rebuilding with a different target (if the code is 100% standard C++, which is portable) to anywhere as hard as rewriting the whole thing (if you use a lot of platform dependent code).