Horde3D
http://horde3d.org/forums/

DLL Confusion
http://horde3d.org/forums/viewtopic.php?f=2&t=1067
Page 1 of 1

Author:  Orm [ 08.01.2010, 00:46 ]
Post subject:  DLL Confusion

Ok, I know how to use static libraries, but Dynamic Libraries ... ehhhhh I'm lost. Do I need to tell the compiler to link it or is all loading and linking done in h3dInit? And are the only H3D files I need to compile into my program Horde3D.h and Horde3DUtils.h or do I need to include everything else as well?

Main question is this, how in the hell does that all work?

Author:  DarkAngel [ 08.01.2010, 01:04 ]
Post subject:  Re: DLL Confusion

It depends on the OS you're using :?

On windows, when you compile Horde it produces a .lib and a .dll

When you compile your game, you include Horde3D.h and you link to the LIB file (just like with a static library). The DLL file must be placed alongside your EXE in order to run your game.

Author:  Orm [ 08.01.2010, 01:09 ]
Post subject:  Re: DLL Confusion

Alright, and Windows is all I am concerning myself with for now. For the record, what about Linux and Mac?

Also, I'd like to post a log of the compile I did only because I find Warnings irksome for some reason.
Code:
||=== Horde3D Engine, Release Win32 ===|
C:\Users\orm\Desktop\Project Data\Horde3D_SDK_1.0.0_Beta4\Horde3D_SDK_1.0.0_Beta4\Horde3D\Source\Horde3DEngine\utOpenGL.h|26|warning: "NOMINMAX" redefined|
C:\MinGW\bin\..\lib\gcc\mingw32\3.4.5\..\..\..\..\include\c++\3.4.5\mingw32\bits\os_defines.h|46|warning: this is the location of the previous definition|
C:\Users\orm\Desktop\Project Data\Horde3D_SDK_1.0.0_Beta4\Horde3D_SDK_1.0.0_Beta4\Horde3D\Source\Horde3DEngine\utTimer.h|20|warning: "NOMINMAX" redefined|
C:\MinGW\bin\..\lib\gcc\mingw32\3.4.5\..\..\..\..\include\c++\3.4.5\mingw32\bits\os_defines.h|46|warning: this is the location of the previous definition|
C:\Users\orm\Desktop\Project Data\Horde3D_SDK_1.0.0_Beta4\Horde3D_SDK_1.0.0_Beta4\Horde3D\Source\Horde3DEngine\utOpenGL.h|26|warning: "NOMINMAX" redefined|
C:\MinGW\bin\..\lib\gcc\mingw32\3.4.5\..\..\..\..\include\c++\3.4.5\mingw32\bits\os_defines.h|46|warning: this is the location of the previous definition|
C:\Users\orm\Desktop\Project Data\Horde3D_SDK_1.0.0_Beta4\Horde3D_SDK_1.0.0_Beta4\Horde3D\Source\Horde3DEngine\utTimer.h|20|warning: "NOMINMAX" redefined|
C:\MinGW\bin\..\lib\gcc\mingw32\3.4.5\..\..\..\..\include\c++\3.4.5\mingw32\bits\os_defines.h|46|warning: this is the location of the previous definition|
C:\Users\orm\Desktop\Project Data\Horde3D_SDK_1.0.0_Beta4\Horde3D_SDK_1.0.0_Beta4\Horde3D\Source\Horde3DEngine\utOpenGL.h|26|warning: "NOMINMAX" redefined|
C:\MinGW\bin\..\lib\gcc\mingw32\3.4.5\..\..\..\..\include\c++\3.4.5\mingw32\bits\os_defines.h|46|warning: this is the location of the previous definition|
C:\Users\orm\Desktop\Project Data\Horde3D_SDK_1.0.0_Beta4\Horde3D_SDK_1.0.0_Beta4\Horde3D\Source\Horde3DEngine\utOpenGL.h|26|warning: "NOMINMAX" redefined|
C:\MinGW\bin\..\lib\gcc\mingw32\3.4.5\..\..\..\..\include\c++\3.4.5\mingw32\bits\os_defines.h|46|warning: this is the location of the previous definition|
C:\Users\orm\Desktop\Project Data\Horde3D_SDK_1.0.0_Beta4\Horde3D_SDK_1.0.0_Beta4\Horde3D\Source\Horde3DEngine\utTimer.h|20|warning: "NOMINMAX" redefined|
C:\MinGW\bin\..\lib\gcc\mingw32\3.4.5\..\..\..\..\include\c++\3.4.5\mingw32\bits\os_defines.h|46|warning: this is the location of the previous definition|
C:\Users\orm\Desktop\Project Data\Horde3D_SDK_1.0.0_Beta4\Horde3D_SDK_1.0.0_Beta4\Horde3D\Source\Horde3DEngine\utOpenGL.h|26|warning: "NOMINMAX" redefined|
C:\MinGW\bin\..\lib\gcc\mingw32\3.4.5\..\..\..\..\include\c++\3.4.5\mingw32\bits\os_defines.h|46|warning: this is the location of the previous definition|
C:\Users\orm\Desktop\Project Data\Horde3D_SDK_1.0.0_Beta4\Horde3D_SDK_1.0.0_Beta4\Horde3D\Source\Horde3DEngine\utOpenGL.h|26|warning: "NOMINMAX" redefined|
C:\MinGW\bin\..\lib\gcc\mingw32\3.4.5\..\..\..\..\include\c++\3.4.5\mingw32\bits\os_defines.h|46|warning: this is the location of the previous definition|
C:\Users\orm\Desktop\Project Data\Horde3D_SDK_1.0.0_Beta4\Horde3D_SDK_1.0.0_Beta4\Horde3D\Source\Horde3DEngine\utTimer.h|20|warning: "NOMINMAX" redefined|
C:\MinGW\bin\..\lib\gcc\mingw32\3.4.5\..\..\..\..\include\c++\3.4.5\mingw32\bits\os_defines.h|46|warning: this is the location of the previous definition|
C:\Users\orm\Desktop\Project Data\Horde3D_SDK_1.0.0_Beta4\Horde3D_SDK_1.0.0_Beta4\Horde3D\Source\Horde3DEngine\utOpenGL.h|26|warning: "NOMINMAX" redefined|
C:\MinGW\bin\..\lib\gcc\mingw32\3.4.5\..\..\..\..\include\c++\3.4.5\mingw32\bits\os_defines.h|46|warning: this is the location of the previous definition|
C:\Users\orm\Desktop\Project Data\Horde3D_SDK_1.0.0_Beta4\Horde3D_SDK_1.0.0_Beta4\Horde3D\Source\Horde3DEngine\utOpenGL.h|26|warning: "NOMINMAX" redefined|
C:\MinGW\bin\..\lib\gcc\mingw32\3.4.5\..\..\..\..\include\c++\3.4.5\mingw32\bits\os_defines.h|46|warning: this is the location of the previous definition|
C:\Users\orm\Desktop\Project Data\Horde3D_SDK_1.0.0_Beta4\Horde3D_SDK_1.0.0_Beta4\Horde3D\Source\Horde3DEngine\utOpenGL.h|26|warning: "NOMINMAX" redefined|
C:\MinGW\bin\..\lib\gcc\mingw32\3.4.5\..\..\..\..\include\c++\3.4.5\mingw32\bits\os_defines.h|46|warning: this is the location of the previous definition|
C:\Users\orm\Desktop\Project Data\Horde3D_SDK_1.0.0_Beta4\Horde3D_SDK_1.0.0_Beta4\Horde3D\Source\Horde3DEngine\egRenderer.cpp|1994|warning: no newline at end of file|
C:\Users\orm\Desktop\Project Data\Horde3D_SDK_1.0.0_Beta4\Horde3D_SDK_1.0.0_Beta4\Horde3D\Source\Horde3DEngine\utOpenGL.h|26|warning: "NOMINMAX" redefined|
C:\MinGW\bin\..\lib\gcc\mingw32\3.4.5\..\..\..\..\include\c++\3.4.5\mingw32\bits\os_defines.h|46|warning: this is the location of the previous definition|
C:\Users\orm\Desktop\Project Data\Horde3D_SDK_1.0.0_Beta4\Horde3D_SDK_1.0.0_Beta4\Horde3D\Source\Horde3DEngine\utTimer.h|20|warning: "NOMINMAX" redefined|
C:\MinGW\bin\..\lib\gcc\mingw32\3.4.5\..\..\..\..\include\c++\3.4.5\mingw32\bits\os_defines.h|46|warning: this is the location of the previous definition|
C:\Users\orm\Desktop\Project Data\Horde3D_SDK_1.0.0_Beta4\Horde3D_SDK_1.0.0_Beta4\Horde3D\Source\Horde3DEngine\utOpenGL.h|26|warning: "NOMINMAX" redefined|
C:\MinGW\bin\..\lib\gcc\mingw32\3.4.5\..\..\..\..\include\c++\3.4.5\mingw32\bits\os_defines.h|46|warning: this is the location of the previous definition|
C:\Users\orm\Desktop\Project Data\Horde3D_SDK_1.0.0_Beta4\Horde3D_SDK_1.0.0_Beta4\Horde3D\Source\Horde3DEngine\utOpenGL.h|26|warning: "NOMINMAX" redefined|
C:\MinGW\bin\..\lib\gcc\mingw32\3.4.5\..\..\..\..\include\c++\3.4.5\mingw32\bits\os_defines.h|46|warning: this is the location of the previous definition|
C:\Users\orm\Desktop\Project Data\Horde3D_SDK_1.0.0_Beta4\Horde3D_SDK_1.0.0_Beta4\Horde3D\Source\Horde3DEngine\utTimer.h|20|warning: "NOMINMAX" redefined|
C:\MinGW\bin\..\lib\gcc\mingw32\3.4.5\..\..\..\..\include\c++\3.4.5\mingw32\bits\os_defines.h|46|warning: this is the location of the previous definition|
C:\Users\orm\Desktop\Project Data\Horde3D_SDK_1.0.0_Beta4\Horde3D_SDK_1.0.0_Beta4\Horde3D\Source\Horde3DEngine\utOpenGL.h|26|warning: "NOMINMAX" redefined|
C:\MinGW\bin\..\lib\gcc\mingw32\3.4.5\..\..\..\..\include\c++\3.4.5\mingw32\bits\os_defines.h|46|warning: this is the location of the previous definition|
C:\Users\orm\Desktop\Project Data\Horde3D_SDK_1.0.0_Beta4\Horde3D_SDK_1.0.0_Beta4\Horde3D\Source\Horde3DEngine\utOpenGL.h|26|warning: "NOMINMAX" redefined|
C:\MinGW\bin\..\lib\gcc\mingw32\3.4.5\..\..\..\..\include\c++\3.4.5\mingw32\bits\os_defines.h|46|warning: this is the location of the previous definition|
||=== Build finished: 0 errors, 41 warnings ===|


Might want to keep that "NOMINMAX" define warning in mind for the next version.

Author:  phoenix64 [ 08.01.2010, 16:19 ]
Post subject:  Re: DLL Confusion

Well, linux behaves a bit different with shared libraries (they are called .so instead of .dll here):
You don't need any .lib, you link directly to the .so, and usually the shared object is then placed in some special path (/usr/lib or /usr/local/lib), if you want to put it next to your application, you have to compile it with a rpath directive. CMake e.g. does this automatically.

Oh, MinGW btw usually does not create a .lib, it creates a .a

And about the warning:
This should fix it (to appear soon in my horde3d hg repository -.-):
Code:
diff --git a/Horde3D/Source/Horde3DEngine/utOpenGL.h b/Horde3D/Source/Horde3DEngine/utOpenGL.h
--- a/Horde3D/Source/Horde3DEngine/utOpenGL.h
+++ b/Horde3D/Source/Horde3DEngine/utOpenGL.h
@@ -23,9 +23,11 @@
 
 #ifdef PLATFORM_WIN
 #   define WIN32_LEAN_AND_MEAN 1
-#   define NOMINMAX
+#   ifndef NOMINMAX
+#       define NOMINMAX
+#   endif
 #   include <windows.h>
-#   include <stddef.h>
+#   include <stddef.h>
 #   define GLAPI __declspec( dllimport )
 #   define GLAPIENTRY _stdcall
 #   define GLAPIENTRYP _stdcall *
@@ -38,7 +40,7 @@
 #      include <Carbon/Carbon.h>
 #   else
 extern "C" void (*glXGetProcAddressARB( const unsigned char *procName ))( void );
-#   endif
+#   endif
 #endif
#endif

Author:  Orm [ 11.01.2010, 01:38 ]
Post subject:  Re: DLL Confusion

That go in Horde3D.h?

Author:  Volker [ 11.01.2010, 09:41 ]
Post subject:  Re: DLL Confusion

No in utOpenGL.h. See:

Quote:
diff --git a/Horde3D/Source/Horde3DEngine/utOpenGL.h b/Horde3D/Source/Horde3DEngine/utOpenGL.h
--- a/Horde3D/Source/Horde3DEngine/utOpenGL.h
+++ b/Horde3D/Source/Horde3DEngine/utOpenGL.h

Author:  DarkAngel [ 11.01.2010, 10:10 ]
Post subject:  Re: DLL Confusion

If I've read that patch right, it means

Open up utOpenGL.h

Remove:
# define NOMINMAX

And replace it with:
# ifndef NOMINMAX
# define NOMINMAX
# endif

Author:  Orm [ 11.01.2010, 12:51 ]
Post subject:  Re: DLL Confusion

Right, right. God I need more sleep. :roll:

Page 1 of 1 All times are UTC + 1 hour
Powered by phpBB® Forum Software © phpBB Group
https://www.phpbb.com/