Re: Static if on release build

2017-10-19 Thread b4s1l3 via Digitalmars-d-learn

On Friday, 20 October 2017 at 02:36:37 UTC, Fra Mecca wrote:
I can't find any documentation regarding conditional 
compilation in release and debug mode.


I have read the page regarding the topicon dlang.org but adding 
the snippet below makes no difference when compiling with dub 
-b release

{
version(full) {
 //do something
} else {
//do something else
}

How can I produce a release version with different parameters 
from debug using dub and static if's?


The most close compile condition is

version(assert)
{
// build for testing
}
else
{
// build for release
}

see https://dlang.org/spec/version.html#predefined-versions:

"assertChecks are being emitted for AssertExpressions"

And at the same time

https://dlang.org/dmd-linux.html#switch-release

"compile release version, which means not emitting run-time 
checks for contracts and asserts. Array bounds checking is not 
done for system and trusted functions, and assertion failures are 
undefined behaviour."


Re: Add a precompiled c++ obj file to dub

2017-10-09 Thread b4s1L3 via Digitalmars-d-learn

On Sunday, 8 October 2017 at 04:03:27 UTC, user1234 wrote:

On Sunday, 8 October 2017 at 02:58:36 UTC, Fra Mecca wrote:

On Saturday, 7 October 2017 at 23:54:50 UTC, user1234 wrote:

On Saturday, 7 October 2017 at 19:56:52 UTC, Fra Mecca wrote:

Hi all,
I am writing a backend that is partly Vibe.d and partly 
clucene in c++.
I have some object files written in c++ and compiled with 
g++ that are not considered by dub during the linking phase 
and throws `function undefined error ` every time.


Is there a way to tell dub to let dmd handle that .o files?


Yes, add this to your JSON:

  "sourceFiles-linux-x86_64" : [
"somepath/yourobject.o"
  ],


I tried the sourceFiles approach, it failed and I could 
reproduce that in some days.


At the end I added them as linking options (lflags) but it is 
kinda odd that it works given that everything is supplied to 
dmd as -Lobj.o


Huh, i'm surprised but well, if it works for you.
My advice was based on 
https://github.com/BBasile/dbeaengine/blob/master/dub.json 
(object file is passed to dmd) which works, I often use it.


Yeah that's becuz passing *.o / *.obj files to the linker or to 
dmd is the same buisness under the hood. The problem with this 
DUB project is that it will only compiles with DMD. Maybe the OP 
used another compiler. other compilers may not support the 
shortcut here:


https://github.com/dlang/dmd/blob/master/src/ddmd/mars.d#L626




Re: how to build project with locally compiled phobos

2017-09-23 Thread B4s1L3 via Digitalmars-d-learn

On Saturday, 23 September 2017 at 11:58:40 UTC, Mengu wrote:

hi all

i've successfully compiled phobos master with gmake on freebsd. 
(make fails, i've no clue at all as to why)


how do i compile my project now against my local phobos with 
dub? with plain dmd?


i tried (in dub.sdl):
- full path to new libphobos.so with -defaultlib to dflags
- full path to new libphobos.so to lflags

i checked with ldd and saw the original libphobos.so was used. 
my current workaround is copying mine to /usr/lib.


thanks in advanced.


Hello, what you want to do is certainly possible but... I'd 
rather build a full custom dmd+runtime+phobos with its own 
sc.conf file Why ?

- Easier to invoke dub w/ the option --compiler=path.
- The custom DMD will alsways use the right phobos (when not 
using dub).





Re: How to check if string is available at compile time

2017-09-22 Thread B4s1L3 via Digitalmars-d-learn
On Thursday, 21 September 2017 at 11:42:36 UTC, David Bennett 
wrote:

Hi Guys,

Is there an easy way to check if the value of string passed to 
a template is available at compile time?




Yeah , sure and I have such a template in my library: 
https://github.com/BBasile/iz/blob/master/import/iz/types.d#L627


see just above too, the template "isCompileTimeValue"


Re: What the hell is wrong with D?

2017-09-19 Thread B4s1L3 via Digitalmars-d-learn
On Wednesday, 20 September 2017 at 02:16:16 UTC, EntangledQuanta 
wrote:
Your an idiot, I know about how operator precedence works far 
more than you do. Wanna bet? how much? Your house? your wife? 
Your life? It's about doing things correctly, you seem to fail 
to understand, not your fault, can't expect a turd to 
understand logic.


You should swallow your ego a bit. In first place you've made an 
error. Just recognize this error, it's not so serious finally. 
You are discrediting yourself for nothing.