April 11, 2017 Re: Single exe vibe.d app | ||||
---|---|---|---|---|
| ||||
Posted in reply to Suliman | On 11/04/2017 8:08 AM, Suliman wrote: > On Friday, 7 April 2017 at 07:15:44 UTC, rikki cattermole wrote: >> I'm going to give you a very bad but still a good place to begin with >> explanation. >> >> So, what is an executable? Well in modern operating systems that is a >> file with a very complex structure inside, like PE-COFF or ELF. It has >> a bunch of things as part of this, a dynamic relocation table, >> sections and symbols. >> >> Now, there is a very important symbol it provides a "main" function. >> Normally the libc takes ownership of this and then on calls to the >> c-main that we all know and love (druntime uses this and then passes >> it to another symbol called _Dmain). >> >> What is the difference between a shared library and an executable? >> Well not much, no main function for starters (although Win32 based >> ones do have something like it in its place) and a couple of >> attributes stored in the file. >> >> Executables like shared libraries are final binaries, they cannot be >> further linked with, at least with the most common formats + linkers >> anyway. >> >> You asked about the difference between a static library and a shared >> library, it isn't quite the right comparison. You should be asking >> about static libraries versus object files. In essence a static >> library is just a group of object files. Not too complicated. > > Ok, but what about Go? I have heard that it's compile all code to single > exe? What is the way it's done there? I can't quote what Go has for a runtime (and if it does the _Dmain trick) but over all, since it is a native language everything I have said should be valid. I just checked[0] it is all completely valid, Go forces you to jump through hoops to do it though. [0] http://blog.hashbangbash.com/2014/04/linking-golang-statically/ |
Copyright © 1999-2021 by the D Language Foundation