www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - What's the difference between

reply "Edn" <charlie.bacon yahoo.com> writes:
Hello,

what's the difference between 
https://github.com/D-Programming-Deimos/glfw and 
https://github.com/DerelictOrg/DerelictGLFW3

thanks in advance
Oct 19 2014
parent reply Mike Parker <aldacron gmail.com> writes:
On 10/20/2014 4:11 AM, Edn wrote:
 Hello,

 what's the difference between
 https://github.com/D-Programming-Deimos/glfw and
 https://github.com/DerelictOrg/DerelictGLFW3

 thanks in advance
The bindings at Deimos have a link-time dependency on GLFW. Whether you want to link with the static library or link with the shared library, you need to with something when compiling your app. All of the bindings in Deimos are like this -- they are /static/ bindings. The Derelict binding has no link-time dependency. You can build your app without having the development version of GLFW on your system. When the app is run, it searches the system path for the GLFW shared library and loads it into memory (you have to call DerelictGLFW3.load() for this to happen). All of the bindings in DerelictOrg are like this -- they are /dynamic/ bindings. --- This email is free from viruses and malware because avast! Antivirus protection is active. http://www.avast.com
Oct 19 2014
parent reply "Edn" <end yahoo.com> writes:
On Sunday, 19 October 2014 at 23:57:33 UTC, Mike Parker wrote:
 On 10/20/2014 4:11 AM, Edn wrote:
 Hello,

 what's the difference between
 https://github.com/D-Programming-Deimos/glfw and
 https://github.com/DerelictOrg/DerelictGLFW3

 thanks in advance
The bindings at Deimos have a link-time dependency on GLFW. Whether you want to link with the static library or link with the shared library, you need to with something when compiling your app. All of the bindings in Deimos are like this -- they are /static/ bindings. The Derelict binding has no link-time dependency. You can build your app without having the development version of GLFW on your system. When the app is run, it searches the system path for the GLFW shared library and loads it into memory (you have to call DerelictGLFW3.load() for this to happen). All of the bindings in DerelictOrg are like this -- they are /dynamic/ bindings. --- This email is free from viruses and malware because avast! Antivirus protection is active. http://www.avast.com
I'm trying to compile a simple program using D and GLFW. I heard that in order to use Deimos GLFW you will have to compile https://github.com/glfw/glfw using the digitalmars c++ compiler since dmd only supports OMF?
Oct 20 2014
next sibling parent reply "Edn" <end yahoo.com> writes:
On Tuesday, 21 October 2014 at 06:41:12 UTC, Edn wrote:
 On Sunday, 19 October 2014 at 23:57:33 UTC, Mike Parker wrote:
 On 10/20/2014 4:11 AM, Edn wrote:
 Hello,

 what's the difference between
 https://github.com/D-Programming-Deimos/glfw and
 https://github.com/DerelictOrg/DerelictGLFW3

 thanks in advance
The bindings at Deimos have a link-time dependency on GLFW. Whether you want to link with the static library or link with the shared library, you need to with something when compiling your app. All of the bindings in Deimos are like this -- they are /static/ bindings. The Derelict binding has no link-time dependency. You can build your app without having the development version of GLFW on your system. When the app is run, it searches the system path for the GLFW shared library and loads it into memory (you have to call DerelictGLFW3.load() for this to happen). All of the bindings in DerelictOrg are like this -- they are /dynamic/ bindings. --- This email is free from viruses and malware because avast! Antivirus protection is active. http://www.avast.com
I'm trying to compile a simple program using D and GLFW. I heard that in order to use Deimos GLFW you will have to compile https://github.com/glfw/glfw using the digitalmars c++ compiler since dmd only supports OMF?
I mean for the libraries
Oct 20 2014
parent "Szymon Gatner" <noemail gmail.com> writes:
On Tuesday, 21 October 2014 at 06:42:17 UTC, Edn wrote:
 On Tuesday, 21 October 2014 at 06:41:12 UTC, Edn wrote:
 On Sunday, 19 October 2014 at 23:57:33 UTC, Mike Parker wrote:
 On 10/20/2014 4:11 AM, Edn wrote:
 Hello,

 what's the difference between
 https://github.com/D-Programming-Deimos/glfw and
 https://github.com/DerelictOrg/DerelictGLFW3

 thanks in advance
The bindings at Deimos have a link-time dependency on GLFW. Whether you want to link with the static library or link with the shared library, you need to with something when compiling your app. All of the bindings in Deimos are like this -- they are /static/ bindings. The Derelict binding has no link-time dependency. You can build your app without having the development version of GLFW on your system. When the app is run, it searches the system path for the GLFW shared library and loads it into memory (you have to call DerelictGLFW3.load() for this to happen). All of the bindings in DerelictOrg are like this -- they are /dynamic/ bindings. --- This email is free from viruses and malware because avast! Antivirus protection is active. http://www.avast.com
I'm trying to compile a simple program using D and GLFW. I heard that in order to use Deimos GLFW you will have to compile https://github.com/glfw/glfw using the digitalmars c++ compiler since dmd only supports OMF?
I mean for the libraries
Is this your beginings with GLFW/OpengGL in D? If yes that I strongly sugest going with dub and Derelict. It all just works without any hustle.
Oct 21 2014
prev sibling parent reply Mike Parker <aldacron gmail.com> writes:
On 10/21/2014 3:41 PM, Edn wrote:

 I'm trying to compile a simple program using D and GLFW. I heard that in
 order to use Deimos GLFW you will have to compile
 https://github.com/glfw/glfw using the digitalmars c++ compiler since
 dmd only supports OMF?
On Windows, when compiling as 32-bit, the compiler makes use of the OPTLINK linker that ships with it. OPTLINK only supports OMF. So you can compile a C library with dmc (which also uses OPTLINK) or you can take a library in COFF format and run it through an object converter (like coff2omf or Agner Fog's Object Converter[1]) to convert it to OMF. When compiling with DMD as 64-bit, the compiler makes use of the Visual Studio toolchain, so you can use 64-bit COFF libraries out of the box after you install the VS tools. If you are linking with the import library instead of a static library, the same idea applies. But in that case you can run a tool like coffimplib on the DLL to create an import library in OMF format, then link with it. Both coff2omf and coffimplib are available, along with other useful utilities, as part of the Digital Mars Extended Utility Package [2] which is available for sale at [3]. This problem does not exist on Linux or Mac as DMD uses the GCC backend for those platforms. [1] http://www.agner.org/optimize/#objconv [2] http://www.digitalmars.com/eup.html [3] http://www.digitalmars.com/shop.html --- This email is free from viruses and malware because avast! Antivirus protection is active. http://www.avast.com
Oct 21 2014
next sibling parent Mike Parker <aldacron gmail.com> writes:
On 10/21/2014 6:38 PM, Mike Parker wrote:
 On 10/21/2014 3:41 PM, Edn wrote:

 I'm trying to compile a simple program using D and GLFW. I heard that in
 order to use Deimos GLFW you will have to compile
 https://github.com/glfw/glfw using the digitalmars c++ compiler since
 dmd only supports OMF?
And actually, I would second Szymon's recommendation to use dub and Derelict. It makes things much simpler. --- This email is free from viruses and malware because avast! Antivirus protection is active. http://www.avast.com
Oct 21 2014
prev sibling parent reply "Edn" <end yahoo.com> writes:
On Tuesday, 21 October 2014 at 09:38:55 UTC, Mike Parker wrote:
 On 10/21/2014 3:41 PM, Edn wrote:

 I'm trying to compile a simple program using D and GLFW. I 
 heard that in
 order to use Deimos GLFW you will have to compile
 https://github.com/glfw/glfw using the digitalmars c++ 
 compiler since
 dmd only supports OMF?
On Windows, when compiling as 32-bit, the compiler makes use of the OPTLINK linker that ships with it. OPTLINK only supports OMF. So you can compile a C library with dmc (which also uses OPTLINK) or you can take a library in COFF format and run it through an object converter (like coff2omf or Agner Fog's Object Converter[1]) to convert it to OMF. When compiling with DMD as 64-bit, the compiler makes use of the Visual Studio toolchain, so you can use 64-bit COFF libraries out of the box after you install the VS tools. If you are linking with the import library instead of a static library, the same idea applies. But in that case you can run a tool like coffimplib on the DLL to create an import library in OMF format, then link with it. Both coff2omf and coffimplib are available, along with other useful utilities, as part of the Digital Mars Extended Utility Package [2] which is available for sale at [3]. This problem does not exist on Linux or Mac as DMD uses the GCC backend for those platforms. [1] http://www.agner.org/optimize/#objconv [2] http://www.digitalmars.com/eup.html [3] http://www.digitalmars.com/shop.html --- This email is free from viruses and malware because avast! Antivirus protection is active. http://www.avast.com
So if I compile DMD as x64 I can then use the libraries for VC120 that comes with the glfw windows binaries ? http://www.glfw.org/download.html and then compile using : dmd -d main.d glfw3.lib
Oct 21 2014
parent reply Mike Parker <aldacron gmail.com> writes:
On 10/21/2014 8:40 PM, Edn wrote:

 http://www.avast.com
So if I compile DMD as x64 I can then use the libraries for VC120 that comes with the glfw windows binaries ? http://www.glfw.org/download.html and then compile using : dmd -d main.d glfw3.lib
You will need to pass -m64 to get 64-bit compilation and will also need to compile and link the deimos glfw module. So assuming something like: main.d -deimos --glfw ---glfw3.d dmd -m64 main.d deimos/glfw/glfw3.d glfw.lib --- This email is free from viruses and malware because avast! Antivirus protection is active. http://www.avast.com
Oct 21 2014
parent reply "Edn" <charlie.bacon yahoo.com> writes:
On Tuesday, 21 October 2014 at 15:42:39 UTC, Mike Parker wrote:
 On 10/21/2014 8:40 PM, Edn wrote:

 http://www.avast.com
So if I compile DMD as x64 I can then use the libraries for VC120 that comes with the glfw windows binaries ? http://www.glfw.org/download.html and then compile using : dmd -d main.d glfw3.lib
You will need to pass -m64 to get 64-bit compilation and will also need to compile and link the deimos glfw module. So assuming something like: main.d -deimos --glfw ---glfw3.d dmd -m64 main.d deimos/glfw/glfw3.d glfw.lib --- This email is free from viruses and malware because avast! Antivirus protection is active. http://www.avast.com
Sorry, I'm very new to D. Anyways, would deimos/glfw/glfw3.d be needed if I have import glfw.glfw3; in my main.d ?
Oct 21 2014
parent reply Mike Parker <aldacron gmail.com> writes:
On 10/22/2014 2:37 AM, Edn wrote:

 Anyways, would
 deimos/glfw/glfw3.d
 be needed if I have
 import glfw.glfw3;
 in my main.d ?
You should be importing deimos.glfw.glfw3, I believe. But the answer is yes. Import statements tell the compiler which symbols are available when compiling a specific module. It does not tell the compiler that you also want to compile the imported module. If you have compiled the deimos module into a library, then you do not need to pass glfw3.d. You would instead link with the library. However, you *always* need to import the modules you want to use. BTW, posts like this probably belong in the digitalmars.D.learn[1]. [1] http://forum.dlang.org/group/digitalmars.D.learn --- This email is free from viruses and malware because avast! Antivirus protection is active. http://www.avast.com
Oct 21 2014
next sibling parent "Edn" <end yahoo.com> writes:
On Wednesday, 22 October 2014 at 01:45:07 UTC, Mike Parker wrote:
 On 10/22/2014 2:37 AM, Edn wrote:

 Anyways, would
 deimos/glfw/glfw3.d
 be needed if I have
 import glfw.glfw3;
 in my main.d ?
You should be importing deimos.glfw.glfw3, I believe. But the answer is yes. Import statements tell the compiler which symbols are available when compiling a specific module. It does not tell the compiler that you also want to compile the imported module. If you have compiled the deimos module into a library, then you do not need to pass glfw3.d. You would instead link with the library. However, you *always* need to import the modules you want to use. BTW, posts like this probably belong in the digitalmars.D.learn[1]. [1] http://forum.dlang.org/group/digitalmars.D.learn --- This email is free from viruses and malware because avast! Antivirus protection is active. http://www.avast.com
Great, thanks!
Oct 22 2014
prev sibling parent reply "Edn" <charlie.bacon yahoo.com> writes:
On Wednesday, 22 October 2014 at 01:45:07 UTC, Mike Parker wrote:
 On 10/22/2014 2:37 AM, Edn wrote:

 Anyways, would
 deimos/glfw/glfw3.d
 be needed if I have
 import glfw.glfw3;
 in my main.d ?
You should be importing deimos.glfw.glfw3, I believe. But the answer is yes. Import statements tell the compiler which symbols are available when compiling a specific module. It does not tell the compiler that you also want to compile the imported module. If you have compiled the deimos module into a library, then you do not need to pass glfw3.d. You would instead link with the library. However, you *always* need to import the modules you want to use. BTW, posts like this probably belong in the digitalmars.D.learn[1]. [1] http://forum.dlang.org/group/digitalmars.D.learn --- This email is free from viruses and malware because avast! Antivirus protection is active. http://www.avast.com
Hello again, I get this error : dmd -m64 main.d lib/glfw/glfw3.d glfw.lib LINK : fatal error LNK1104: cannot open file 'glfw.lib' --- errorlevel 1104
Oct 22 2014
parent reply Mike Parker <aldacron gmail.com> writes:
On 10/23/2014 2:51 AM, Edn wrote:

 I get this error :

 dmd -m64 main.d lib/glfw/glfw3.d glfw.lib
 LINK : fatal error LNK1104: cannot open file 'glfw.lib'
 --- errorlevel 1104
Did you download and compile GLFW3 as a static library? If so, then whatever lib file that resulted needs to be somewhere the linker can find it. IIRC, it's probably called glfw3.lib. If it's in a subdirectory of your project, then you should refer to it by the relative path. If you're keeping it somewhere else on your system, then you either need to refer to it by the full path or to add it to the library path via the command line so the linker can find it. For the latter, you need to use whatever syntax the current linker understands (OPTLINK when compiling 32-bit on Windows, VS LINK when compiling 64-bit on Windows, or the GCC linker on other systems). So, let's assume you've done the following: 1) Download and compiled the C GLFW3 library and the output is called 'glfw3.lib'. 2) You've got the source set up like you show above: -project --main.d --lib ---glfw ----glfw3.d Let me make a recommendation that will make things a little more coherent. Set up your project this way: -project --source ---main.d ---glfw ----glfw3.d --lib ---glfw3.lib Notice how I've copied glfw3 to the 'lib' directory Now I can do the following: cd project dmd -m64 -Isource source/main.d source/glfw/glfw3.d lib/glfw3.lib Notice that I passed the -I switch to tell DMD to look for imports inside the source directory. That way, it won't try to use 'source' as a package name. If I were compiling inside the source directory (i.e. cd project/source) I wouldn't need to do that. Let's say you want to use glfw3.lib with multiple projects and want to have it in a common location. Then the project structure will be the same, but now without the 'lib' directory. So let's say you've copied glfw3.lib to somewhere like C:\libs. Then you can do this: cd project dmd -m64 -Isource -L/LIBPATH:C:\libs source/main.d source/glfw/glfw3.d glfw3.lib The -L switch tells dmd to pass whatever follows it to the linker. /LIBPATH is how you tell the VS linker where to look for libraries (I haven't tested this myself, but it's what the docs at [1] say). Now, when it encounters glfw3.lib, it will search in that path. If you were compiling on Linux, it would look like: -L-L/path/to/libs The first -L is for DMD and the second is for the linker, since that's the flag the gcc linker uses to set the library search path [2]. And with 32-bit compilation on Windows using OPTLINK, it looks even different [3]: -L+C:\libs You always need to be aware that the compiler can parese imports it can't find & can't compile source you don't tell it to, and the linker can't link libraries it can't find. When you're dealing with multiple source files and libraries, compiling on the command line can be very burdonsome, which is why build tools exist. Something like DUB makes this all go away. Then building (usually) becomes as easy as: cd project dub build I'm not recommending you switch to DUB right now, since understanding command line compilation is an important skill, but once you *are* comfortable with it, switching to DUB will make your life easier. [1] http://msdn.microsoft.com/en-us/library/1xhzskbe.aspx [2] https://gcc.gnu.org/onlinedocs/gcc/Directory-Options.html [3] http://www.prowiki.org/wiki4d/wiki.cgi?D__Tutorial/CompilingLinkingD#PassingsearchdirectoriesforstaticlibraryfilestoOptlink
Oct 23 2014
parent Mike Parker <aldacron gmail.com> writes:
On 10/23/2014 5:22 PM, Mike Parker wrote:
 the compiler can parese imports
/can't parse/
Oct 23 2014