Jump to page: 1 2
Thread overview
Single exe vibe.d app
Apr 05, 2017
Satoshi
Apr 05, 2017
evilrat
Apr 05, 2017
evilrat
Apr 05, 2017
Inquie
Apr 06, 2017
Satoshi
Apr 05, 2017
Nicholas Wilson
Apr 06, 2017
Stefan Koch
Apr 07, 2017
Suliman
Apr 07, 2017
rikki cattermole
Apr 11, 2017
Suliman
Apr 11, 2017
rikki cattermole
April 05, 2017
Hi,
How can I build single exe application with vibe.d (windows)?
now it require zlib.dll, libeay32.dll and ssleay32.dll

But I need it as single app.
April 05, 2017
On Wednesday, 5 April 2017 at 12:13:38 UTC, Satoshi wrote:
> Hi,
> How can I build single exe application with vibe.d (windows)?
> now it require zlib.dll, libeay32.dll and ssleay32.dll
>
> But I need it as single app.

you have to build those as static libraries first, compile vibe.d with that static libs provided to linker(you are most likely will be forced to x64 or m32mscoff depending on compilers used) and that *should* be enough.

but there may arise some non obviuos issues such as licensing(some licenses prohibits even linking with some other licenced code) or linking issues, or full disability to do so if dynamic loading is used, or whatever i forgot to remember.

sorry if it lacks details. thats just whole process in common.
April 05, 2017
On Wednesday, 5 April 2017 at 12:13:38 UTC, Satoshi wrote:
> Hi,
> How can I build single exe application with vibe.d (windows)?
> now it require zlib.dll, libeay32.dll and ssleay32.dll
>
> But I need it as single app.

btw, if all you need is to ship it as a single file and don't care if it writes anything, you can probably compile-in those .dll's to your .exe as string with D import statement and write them on disk from static module ctor (static shared this{} at module scope) when it launched.
April 05, 2017
On Wednesday, 5 April 2017 at 12:13:38 UTC, Satoshi wrote:
> Hi,
> How can I build single exe application with vibe.d (windows)?
> now it require zlib.dll, libeay32.dll and ssleay32.dll
>
> But I need it as single app.

As Evilrat notes static libraries are one solution, the catch being you need to get them as static libraries. zlib you should easily be able to get as a static lib (making sure you use a compatible linker/ linker format.

If for the other libraries that is not possible one approach is described on the d idioms list: http://p0nce.github.io/d-idioms/#Embed-a-dynamic-library-in-an-executable

The static library solution is probably the superior choice if available.
April 05, 2017
On Wednesday, 5 April 2017 at 12:42:23 UTC, evilrat wrote:
> On Wednesday, 5 April 2017 at 12:13:38 UTC, Satoshi wrote:
>> Hi,
>> How can I build single exe application with vibe.d (windows)?
>> now it require zlib.dll, libeay32.dll and ssleay32.dll
>>
>> But I need it as single app.
>
> btw, if all you need is to ship it as a single file and don't care if it writes anything, you can probably compile-in those .dll's to your .exe as string with D import statement and write them on disk from static module ctor (static shared this{} at module scope) when it launched.

Why is the writing to disk necessary? Seems like a costly step for no real benefit. The dll gets read in to memory anyways.

https://github.com/fancycode/MemoryModule
April 06, 2017
On Wednesday, 5 April 2017 at 12:42:23 UTC, evilrat wrote:
> On Wednesday, 5 April 2017 at 12:13:38 UTC, Satoshi wrote:
>> Hi,
>> How can I build single exe application with vibe.d (windows)?
>> now it require zlib.dll, libeay32.dll and ssleay32.dll
>>
>> But I need it as single app.
>
> btw, if all you need is to ship it as a single file and don't care if it writes anything, you can probably compile-in those .dll's to your .exe as string with D import statement and write them on disk from static module ctor (static shared this{} at module scope) when it launched.

It's not possible because exe will not run when dll is missing. Phobos (or vibe.d ?) doesn't load dll dynamically by dlopen but link with .lib of the .dll
April 06, 2017
On Wednesday, 5 April 2017 at 12:13:38 UTC, Satoshi wrote:
> Hi,
> How can I build single exe application with vibe.d (windows)?
> now it require zlib.dll, libeay32.dll and ssleay32.dll
>
> But I need it as single app.

One solution would be to compile vibe.d without ssl support
that way it will not need libeay32 and ssleay32

It should not need zlib, really as zlib is already linked into phobos.

April 07, 2017
On Thursday, 6 April 2017 at 17:39:15 UTC, Stefan Koch wrote:
> On Wednesday, 5 April 2017 at 12:13:38 UTC, Satoshi wrote:
>> Hi,
>> How can I build single exe application with vibe.d (windows)?
>> now it require zlib.dll, libeay32.dll and ssleay32.dll
>>
>> But I need it as single app.
>
> One solution would be to compile vibe.d without ssl support
> that way it will not need libeay32 and ssleay32
>
> It should not need zlib, really as zlib is already linked into phobos.

Could anybody give very easy explanation about what different between static and dynamic libs. I read a lot of information that dynamic lib allow to loading at runtime and bla-bla-bla, but still do not understand what different between compilation at dynamic and static lib.

For example:
1. Does every lib can be compiler as static and as dynamic?
2. Can already compiled lib be converted to from static to dynamic and vise-versa.
3. If I have any dynamic lib, the only way is distribute it with app (or use import) or there is way to embed code from it to app?

Personaly I like if I can get single bin without any external dependence. In a lot of cases size do not important, it's better to have single bin, than heap of libs.
April 07, 2017
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.
April 11, 2017
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?
« First   ‹ Prev
1 2