Re: How bundles a Dlang application and all its dependencies into a single .exe package?

2019-12-01 Thread rikki cattermole via Digitalmars-d-learn

On 02/12/2019 9:05 AM, Marcone wrote:

My program have Qt5 GUI that use dlls, icons, pictures, etc.

How bundles a Dlang application and all its dependencies into a single 
.exe package?


Placing all your assets into an exe is usually done if the exe itself is 
self extracting (and doesn't link against a shared library, dynamically 
is fine). In other words it doesn't have your code linked in.


There is no one right way to do this.
As others have stated e.g. NSIS, Bin2d(mine).

Unless the size of the assets are small-ish, I wouldn't want it all to 
be stored in the executable that contains your code. It would be too big 
and have problems.


Keep them separate and have an installer if a zip archive isn't good 
enough ;)


Re: Building and running DMD tests

2019-12-01 Thread Suleyman via Digitalmars-d-learn

On Sunday, 1 December 2019 at 15:20:42 UTC, Per Nordlöw wrote:
Is it possible to compile and run unittest of dmd without 
druntime and phobos?


If so, how?

I'm trying the following under dmd root:

make -C src -f posix.mak unittest
./generated/linux/release/64/dmd-unittest

but that doesn't compile my file of interest

test/compilable/traits.d

.

How can I make sure that all the files under /test/compilable 
compiles?


The command you need is "make -Ctest". Or you can run a specific 
test manually using run.d.

```
cd test/
./run.d compilable/traits.d
```



Re: How bundles a Dlang application and all its dependencies into a single .exe package?

2019-12-01 Thread Taylor R Hillegeist via Digitalmars-d-learn

On Sunday, 1 December 2019 at 20:05:40 UTC, Marcone wrote:

My program have Qt5 GUI that use dlls, icons, pictures, etc.

How bundles a Dlang application and all its dependencies into a 
single .exe package?


I've used https://github.com/rikkimax/Bin2D in the past. I've 
never thought about the license issue before with dlls. probably 
some kind of grey area here. since they would still be seperate 
from the executable but also contained in them?


Re: Building and running DMD tests

2019-12-01 Thread Jonathan M Davis via Digitalmars-d-learn
On Sunday, December 1, 2019 8:20:42 AM MST Per Nordlöw via Digitalmars-d-
learn wrote:
> Is it possible to compile and run unittest of dmd without
> druntime and phobos?
>
> If so, how?
>
> I'm trying the following under dmd root:
>
>  make -C src -f posix.mak unittest
>  ./generated/linux/release/64/dmd-unittest
>
> but that doesn't compile my file of interest
>
> test/compilable/traits.d
>
> .
>
> How can I make sure that all the files under /test/compilable
> compiles?

dmd's tests are designed to be run after you've built druntime and Phobos.
If you look at the tests, many of them import modules from both druntime
and/or Phobos. IIRC, there has been some discussion about whether that
should be changed, but AFAIK, there has been no agreement to do so. I'm also
not sure that it even _can_ be done with regards to druntime, because every
D program that isn't compiled with -betterC requires at least druntime. So,
at most, it would probably mean not requiring Phobos, but either way, at the
moment, the tests in general expect Phobos to have been built and be
available. I don't know how possible it is to get around that with a
specific test module that doesn't actually use Phobos, but that's not how
the tests are normally run, and you'd need druntime regardless.

In addition, I believe that the unittest target that you're trying to build
is specifically for running all of the unittest blocks in the dmd source
code, not for running the tests in the test folder. Those are built using
the makefile in the test folder or by running the test target from the
primary makefile with the target test (which also runs the unittest blocks
in the src folder), whereas you're specifically using the makefile in src.

- Jonathan M Davis






Re: How bundles a Dlang application and all its dependencies into a single .exe package?

2019-12-01 Thread Dennis via Digitalmars-d-learn

On Sunday, 1 December 2019 at 20:05:40 UTC, Marcone wrote:
How bundles a Dlang application and all its dependencies into a 
single .exe package?


You can embed files in the .exe using the import statement:
https://p0nce.github.io/d-idioms/#Embed-a-dynamic-library-in-an-executable


Re: How bundles a Dlang application and all its dependencies into a single .exe package?

2019-12-01 Thread Ferhat Kurtulmuş via Digitalmars-d-learn

On Sunday, 1 December 2019 at 20:05:40 UTC, Marcone wrote:

My program have Qt5 GUI that use dlls, icons, pictures, etc.

How bundles a Dlang application and all its dependencies into a 
single .exe package?


There are several tools creating installers such as nsis. 
However, if you want to make an all-in-one portable app (there 
are tools doing it too), you have to be sure that the licenses of 
your dependencies allow doing it. I don't think you are allowed 
to do it using Qt.


How bundles a Dlang application and all its dependencies into a single .exe package?

2019-12-01 Thread Marcone via Digitalmars-d-learn

My program have Qt5 GUI that use dlls, icons, pictures, etc.

How bundles a Dlang application and all its dependencies into a 
single .exe package?


Building and running DMD tests

2019-12-01 Thread Per Nordlöw via Digitalmars-d-learn
Is it possible to compile and run unittest of dmd without 
druntime and phobos?


If so, how?

I'm trying the following under dmd root:

make -C src -f posix.mak unittest
./generated/linux/release/64/dmd-unittest

but that doesn't compile my file of interest

test/compilable/traits.d

.

How can I make sure that all the files under /test/compilable 
compiles?


Re: Hum Humm, Typedef

2019-12-01 Thread aliak via Digitalmars-d-learn

On Saturday, 30 November 2019 at 18:15:47 UTC, Treebeard wrote:
Hoom, hum, I met a dark forest of complains from the compilers 
here.


[...]


/me thinks it's a bug

Pushed a pr. Let's see.

https://github.com/dlang/phobos/pull/7298


Re: Run-time reflection for class inheritance

2019-12-01 Thread Adam D. Ruppe via Digitalmars-d-learn

On Sunday, 1 December 2019 at 12:26:03 UTC, Michael Green wrote:
I don't know if this would be a sensible approach to try and 
get at the actual class types for objects stored in some 
container at runtime?


You can get the type at runtime by simply casting it...

if(auto c = cast(EventSocket) event) {
   // is an event socket
}


and then you can actually use the c object too.

Or if you put the necessary functionality in the interface then 
you simply call the method - this is better object-oriented 
design as it reduces the necessary knowledge for the function to 
use the object.


Re: Run-time reflection for class inheritance

2019-12-01 Thread Michael Green via Digitalmars-d-learn

On Sunday, 1 December 2019 at 12:26:03 UTC, Michael Green wrote:

interface Event {



[note to self - shouldn't make last minute checks and reverse 
them by hand before posting]


That should of course read:


class Event {


Run-time reflection for class inheritance

2019-12-01 Thread Michael Green via Digitalmars-d-learn
I don't know if this would be a sensible approach to try and get 
at the actual class types for objects stored in some container at 
runtime?


I have noticed that this approach doesn't work if Event is an 
interface rather than a ancestor class.



```
import std.stdio;
import std.string;
import std.traits;
import std.conv;

interface Event {
void report() {
writeln("an event");
}
}

class EventTimer : Event {
override void report() {
writeln("timer event");
}
}

class EventSocket: Event {
override void report() {
writeln("socket event");
}
}

void main(string[] args) {

Event[] events;

foreach (arg; args[1..$]) {
// just something to pick actual type at runtime
if (to!int(arg) > 5) {
events ~= new EventTimer();
} else {
events ~= new EventSocket();
}
}

foreach (event; events) {

switch (event.classinfo.name) {
case fullyQualifiedName!EventTimer:
writeln("found timer event");
break;
case fullyQualifiedName!EventSocket:
writeln("found socket event");
break;
default:
throw new Exception("unknown event type");
break;
}

event.report();
}
}
```