Re: [Semi-OT] I don't want to leave this language!

2016-12-05 Thread Nicholas Wilson via Digitalmars-d-learn

On Monday, 5 December 2016 at 20:49:50 UTC, e-y-e wrote:
On Monday, 5 December 2016 at 20:25:00 UTC, Ilya Yaroshenko 
wrote:

[...]


You know from the 15th December I will have a month of free 
time, and I would love to get myself up to speed with Mir to 
contribute to it. If you don't mind me saying, I think Mir 
could be one of the best things for the future of D (along with 
LDC) and I'd be glad to help it on its way.


That'd be great, drop in to our gitter some time 
https://gitter.im/libmir/public if you have any questions. The 
modules last updated before November are not very interesting at 
the moment. dcompute is, but is waiting on pulls for LDC.


Re: Set Intersection of SortedRanges

2016-12-05 Thread Nicholas Wilson via Digitalmars-d-learn
Whoops forgot to add checks for .empty on the ranges, and I don't 
think reduce!equal work but you get the point.


Re: Set Intersection of SortedRanges

2016-12-05 Thread Nicholas Wilson via Digitalmars-d-learn
On Tuesday, 6 December 2016 at 01:46:38 UTC, Nicholas Wilson 
wrote:

On Monday, 5 December 2016 at 22:10:34 UTC, Nordlöw wrote:

On Monday, 5 December 2016 at 21:48:49 UTC, Nordlöw wrote:

Ahh, setops has intersection aswell:

https://dlang.org/phobos/std_algorithm_setops.html#setIntersection

I should have a guessed that.


Ahh again, but current Phobos is currently not optimized for 
the case when all inputs are SortedArrays. In that case a 
double binary search algorithm as describe here


http://cs.stackexchange.com/a/37124/25769

might be faster.

Has anybody already done this?


The double binary search linked only finds *one* element of the 
intersection.


It should be as simple as a linear find (over the range of 
ranges) that returns (i.e. caches to .front) if the elements 
intersect.


Hmm not sure that will work.

The annoying property of this problem is calculating .empty and 
having .empty not mutate the ranges. however if you settle for an 
eager empty something like


auto setIntersect(RoR,alias _pred)(RoR ror) if (allSatisfy!(RoR, 
isSortedRange!_pred) &&
  
allSatisfy!(RoR, isSame!(ElementType) &&
 
!allSatisfy!(RoR, isRandomAccessRange))

{
enum lengths = RoR.length;
alias elem = ElementType!(RoR[0]);
alias pred = BinaryFun!_pred;
struct SetIntersect
{
RoR ror;
elem[lengths] fronts = void;
elem front = void;
bool valid = false;
this(RoR r)
{
ror = r;
populate();
}
void populate()
{
foreach(i, ref r; ror)
  fronts[i] = r.front;
}
void advance()
{
foreach( ref r; ror)
r.popFront();
}
void popFront() { valid = false; }
bool empty()
{
if (valid) return false;
advance();
populate();
if (reduce!(equal)(fronts)) return false;
elem m = reduce!(pred)(fronts);
foreach(i, ref r; ror)
{
  while(!pred(r.front,m))
 r.popFront();

}
populate();
valid = reduce!(equal)(fronts));
return !valid;
}

}
}



Re: Set Intersection of SortedRanges

2016-12-05 Thread Nicholas Wilson via Digitalmars-d-learn

On Monday, 5 December 2016 at 22:10:34 UTC, Nordlöw wrote:

On Monday, 5 December 2016 at 21:48:49 UTC, Nordlöw wrote:

Ahh, setops has intersection aswell:

https://dlang.org/phobos/std_algorithm_setops.html#setIntersection

I should have a guessed that.


Ahh again, but current Phobos is currently not optimized for 
the case when all inputs are SortedArrays. In that case a 
double binary search algorithm as describe here


http://cs.stackexchange.com/a/37124/25769

might be faster.

Has anybody already done this?


The double binary search linked only finds *one* element of the 
intersection.


It should be as simple as a linear find (over the range of 
ranges) that returns (i.e. caches to .front) if the elements 
intersect.




Re: [Semi-OT] I don't want to leave this language!

2016-12-05 Thread sarn via Digitalmars-d-learn

On Monday, 5 December 2016 at 17:18:25 UTC, e-y-e wrote:
Currently I have been learning D for about a year and a half. 
This may seem like a short time, but this is the longest I have 
stuck with any language. I have only been learning for 4 years 
and I am currently in university studying first year of 
computer systems engineering.

...
Does anyone have any advice for me?


Honestly, I recommend just learning C and C++.  Especially C if 
you're into low level stuff.  You won't just broaden your job 
market, you'll learn stuff that will help you use D more 
effectively.  You don't have to think of it as "leaving" the 
language.


how can I replace some of the great things about D? Things like 
built-in unittests, sane static if, painless CTFE, ranges, or 
even just the DUB package manager/build tool.


You'll have to learn to do without them :)


Re: Set Intersection of SortedRanges

2016-12-05 Thread Nordlöw via Digitalmars-d-learn

On Monday, 5 December 2016 at 21:48:49 UTC, Nordlöw wrote:

Ahh, setops has intersection aswell:

https://dlang.org/phobos/std_algorithm_setops.html#setIntersection

I should have a guessed that.


Ahh again, but current Phobos is currently not optimized for the 
case when all inputs are SortedArrays. In that case a double 
binary search algorithm as describe here


http://cs.stackexchange.com/a/37124/25769

might be faster.

Has anybody already done this?


Re: Set Intersection of SortedRanges

2016-12-05 Thread Nordlöw via Digitalmars-d-learn

On Monday, 5 December 2016 at 21:34:39 UTC, Nordlöw wrote:
What's the fastest way of calculating a set-intersection of two 
or more SortedRanges (all containing unique values)?


Ahh, setops has intersection aswell:

https://dlang.org/phobos/std_algorithm_setops.html#setIntersection

I should have a guessed that.


Re: Set Union of SortedRanges

2016-12-05 Thread Nordlöw via Digitalmars-d-learn

On Monday, 5 December 2016 at 20:18:24 UTC, Nordlöw wrote:
What's the fastest way of calculating a set-union of two or 
more SortedRanges (all containing unique values)?


Doh, I meant intersection, not union:

http://forum.dlang.org/post/jthiwaxkyykalwfyk...@forum.dlang.org


Set Intersection of SortedRanges

2016-12-05 Thread Nordlöw via Digitalmars-d-learn
What's the fastest way of calculating a set-intersection of two 
or more SortedRanges (all containing unique values)?


Any typical branchings of the algorithm depending on the lengths 
of the SortedRanges?


Re: [Semi-OT] I don't want to leave this language!

2016-12-05 Thread e-y-e via Digitalmars-d-learn

On Monday, 5 December 2016 at 20:25:00 UTC, Ilya Yaroshenko wrote:

Hi e-y-e,

The main problem with D for production is its runtime. GC, 
DRuntime, Phobos is big constraint for real world software 
production.


Good D code should be nothrow, @nogc, and betterC. BetterC 
means that it must not require DRuntime to link and to start. I 
started Mir as scientific/numeric project, but it is going to 
be a replacement for Phobos to use D instead/with of C/C++.


For example, Mir CPUID, Mir GLAS, Mir Random are nothrow @nogc 
and do not need DRuntime to start/link. (Mir Random is not 
tested for BetterC, so maybe few dependencies are exist.) Mir 
Random covers C++11 random number generation for example.


If D code can be compiled into a common C libraries like Mir 
libs, than you can include it into existing ecosystem. 
Currently it is possible only with LDC (requires some 
programming techniques for now).


I will be happy to see more Mir contributors [1]

Currently there are 5 Mir devs (not all are visible publicly).

[1] https://github.com/libmir

Cheers,
Ilya


You know from the 15th December I will have a month of free time, 
and I would love to get myself up to speed with Mir to contribute 
to it. If you don't mind me saying, I think Mir could be one of 
the best things for the future of D (along with LDC) and I'd be 
glad to help it on its way.


Re: [Semi-OT] I don't want to leave this language!

2016-12-05 Thread Ilya Yaroshenko via Digitalmars-d-learn

Hi e-y-e,

The main problem with D for production is its runtime. GC, 
DRuntime, Phobos is big constraint for real world software 
production.


Good D code should be nothrow, @nogc, and betterC. BetterC means 
that it must not require DRuntime to link and to start. I started 
Mir as scientific/numeric project, but it is going to be a 
replacement for Phobos to use D instead/with of C/C++.


For example, Mir CPUID, Mir GLAS, Mir Random are nothrow @nogc 
and do not need DRuntime to start/link. (Mir Random is not tested 
for BetterC, so maybe few dependencies are exist.) Mir Random 
covers C++11 random number generation for example.


If D code can be compiled into a common C libraries like Mir 
libs, than you can include it into existing ecosystem. Currently 
it is possible only with LDC (requires some programming 
techniques for now).


I will be happy to see more Mir contributors [1]

Currently there are 5 Mir devs (not all are visible publicly).

[1] https://github.com/libmir

Cheers,
Ilya



Set Union of SortedRanges

2016-12-05 Thread Nordlöw via Digitalmars-d-learn
What's the fastest way of calculating a set-union of two or more 
SortedRanges (all containing unique values)?


Any typical branchings of the algorithm depending on the lengths 
of the SortedRanges?


Re: [Semi-OT] I don't want to leave this language!

2016-12-05 Thread bachmeier via Digitalmars-d-learn

On Monday, 5 December 2016 at 17:18:25 UTC, e-y-e wrote:
Currently I have been learning D for about a year and a half. 
This may seem like a short time, but this is the longest I have 
stuck with any language. I have only been learning for 4 years 
and I am currently in university studying first year of 
computer systems engineering.


My main problem is that now I am looking for industry 
placements, it is clear that in this field C and C++ are highly 
desired. I have used C++ prior to discovering D, but much of my 
learning curve has occured while using D, and I feel quite 
comfortable using it. Using D makes me look back at what a 
great language it is compared to C++ (I know it can also be 
compared to C but I haven't used C).


So I don't want to go back. It isn't as if I have a career in 
C++ (like I know some people here have) and use D (only) for 
pleasure so I have no real knowledge of how things I write in D 
compare to what I would do in C++ (and none whatsoever for C).


Does anyone have any advice for me? Obviously I'm going to have 
to make this leap and the organizations will have their own 
ecosystem but while I'm learning how can I replace some of the 
great things about D? Things like built-in unittests, sane 
static if, painless CTFE, ranges, or even just the DUB package 
manager/build tool.


Failing that, think of this as another one of those 'D is 
great!' posts ;). And whatever happens, I'll certainly try and 
convince my host company to use it...


I'm an academic, so no useful advice. I was reminded when reading 
your post of all the comments from Lisp, Scheme, Haskell, and 
[insert language] users that are able to choose their language 
for much of their job. Many use Lisp. Just not for production. An 
advantage of D is that you can mix C/C++ with D, so that 
increases the chance of using it.


Re: @property get/set or public varaible?

2016-12-05 Thread ArturG via Digitalmars-d-learn
On Sunday, 4 December 2016 at 20:44:05 UTC, Jonathan M Davis 
wrote:
On Sunday, December 04, 2016 15:30:22 vladdeSV via 
Digitalmars-d-learn wrote:

Hello!

I have a question not directly related to D as it is with 
coding standards.


My issue at hand is if I have one variable for a class, which I
want to be directly accessible for anything else, should it be
  1. public, or
  2. private, with @property get/setters?

 From what I have been told is that variables should be 
private.
But if I do not want to make any checks whatsoever when 
setting a

variable, I see no benefit to the private approach.

Are there any other reasons to use get/setters?





This might not be usefull for ure current usecase but if you want 
a property to behave like a field, it has to be a field.
So a boxed type might be better depending how much you want to 
manage.

Here are some property like examples:

   struct Prop(T)
   {
  private T value;

  alias opCall this;
  ref T opCall() { return value; }
  ref T opCall(T val) { return value = val; }
  string toString() { import std.conv: to; return 
value.to!string; }

   }

   struct ReadOnly(T)
   {
  private T value;

  alias opCall this;
  T opCall() { return value; } // return a copy
  string toString() { import std.conv: to; return 
value.to!string; }

   }

   struct WriteOnly(T)
   {
  private T value;

  void opAssign(T val) { value = val; }
  string toString() { return typeof(this).stringof; }
   }

// alternative write only so you can chain opCall 
writeOnly(33)(56)(66);

struct AltWriteOnly(T)
   {
  private T value;

  ref typeof(this) opCall(T val) { value = val; return this; }
  string toString() { return typeof(this).stringof; }
   }

   struct FunProp(T) if(isSomeFunction!T)
   {
  private T value;

  alias value this;
  void opAssign(T val) { value = val; }
  string toString() { return T.stringof; }
   }


   class Test
   {
   Prop!int someVal;
   ReadOnly!string name;
   WriteOnly!int someOtherVal;
   FunProp!(void delegate(int)) funProp;

   this()
   {
   name.value = "Test";
   }
   }

   void main()
   {
   auto test = new Test;
   test.someVal = 66;
   test.someVal++;
   test.someOtherVal = 100;
   test.funProp = (int i) => i + test.someVal;
   test.someVal.writeln;
   test.name.writeln;
   test.funProp(33).writeln;
   test.funProp.writeln;
   test.someOtherVal.writeln;
   }

haven't done extencive tests with them but they can be used as 
builing blocks, you can add other operator overloads to manage 
other access to the value.

you can build better properties without @property :/


Re: Building with dub fails on Ubuntu 16.10.

2016-12-05 Thread moe via Digitalmars-d-learn

On Monday, 5 December 2016 at 07:32:21 UTC, Daniel Kozak wrote:

On Saturday, 3 December 2016 at 16:07:47 UTC, moe wrote:
On Sunday, 11 September 2016 at 02:17:21 UTC, Vlasov Roman 
wrote:

Hello, guys.
I tried to build HelloWorld with dub, but i got strange 
linker error:


[...]



I just switched from Windows to linux (arch) and got the exact 
same problem. Did you resolve this yet? I'm not very 
experienced with development on linux any hint here would be 
welcome.


On arch linux there should not be any issue. Archlinux does not 
use fPIC by default so, this error seems like you have 
something wrong with your Archlinux installation.


Thanks for the tip. I haven't done a lot of development on linux 
so I messed quite a bit with my arch install. It's very well 
possible that I messed something up. I am planing to reinstall in 
a few weeks anyway :)


Having said that, from the arch wiki: 
https://wiki.archlinux.org/index.php/D_(programming_language)
Looks like there is a hardening-wrapper which forces PIC by 
default. As clang worked just fine I assumed that was the actual 
problem. I will look into it again once I reinstalled my system.


Re: the best language I have ever met(?)

2016-12-05 Thread Igor Shirkalin via Digitalmars-d-learn

On Monday, 5 December 2016 at 17:27:21 UTC, Igor Shirkalin wrote:

On Monday, 5 December 2016 at 16:39:33 UTC, eugene wrote:
On Monday, 5 December 2016 at 16:07:41 UTC, Igor Shirkalin 
wrote:
I didnt count, but its about ten thousend a year, i.e. 
nothing.


if you earned nothing using D language why do you recommend 
it?)))

People usually earn money using programming langs.
some people have nothing about science. Some of them are god's 
addicted. I don't think D is here. We are out of here. We 
should go to facebook and keep here if you take it. that's it.


I think we have to stop.



Re: the best language I have ever met(?)

2016-12-05 Thread Igor Shirkalin via Digitalmars-d-learn

On Monday, 5 December 2016 at 16:39:33 UTC, eugene wrote:
On Monday, 5 December 2016 at 16:07:41 UTC, Igor Shirkalin 
wrote:

I didnt count, but its about ten thousend a year, i.e. nothing.


if you earned nothing using D language why do you recommend 
it?)))

People usually earn money using programming langs.
some people have nothing about science. Some of them are god's 
addicted. I don't think D is here. We are out of here. We should 
go to facebook and keep here if you take it. that's it.


[Semi-OT] I don't want to leave this language!

2016-12-05 Thread e-y-e via Digitalmars-d-learn
Currently I have been learning D for about a year and a half. 
This may seem like a short time, but this is the longest I have 
stuck with any language. I have only been learning for 4 years 
and I am currently in university studying first year of computer 
systems engineering.


My main problem is that now I am looking for industry placements, 
it is clear that in this field C and C++ are highly desired. I 
have used C++ prior to discovering D, but much of my learning 
curve has occured while using D, and I feel quite comfortable 
using it. Using D makes me look back at what a great language it 
is compared to C++ (I know it can also be compared to C but I 
haven't used C).


So I don't want to go back. It isn't as if I have a career in C++ 
(like I know some people here have) and use D (only) for pleasure 
so I have no real knowledge of how things I write in D compare to 
what I would do in C++ (and none whatsoever for C).


Does anyone have any advice for me? Obviously I'm going to have 
to make this leap and the organizations will have their own 
ecosystem but while I'm learning how can I replace some of the 
great things about D? Things like built-in unittests, sane static 
if, painless CTFE, ranges, or even just the DUB package 
manager/build tool.


Failing that, think of this as another one of those 'D is great!' 
posts ;). And whatever happens, I'll certainly try and convince 
my host company to use it...


Re: the best language I have ever met(?)

2016-12-05 Thread eugene via Digitalmars-d-learn

On Monday, 5 December 2016 at 16:07:41 UTC, Igor Shirkalin wrote:

I didnt count, but its about ten thousend a year, i.e. nothing.


if you earned nothing using D language why do you recommend it?)))
People usually earn money using programming langs.



Re: the best language I have ever met(?)

2016-12-05 Thread Igor Shirkalin via Digitalmars-d-learn

On Saturday, 3 December 2016 at 15:02:35 UTC, eugene wrote:
On Friday, 18 November 2016 at 17:54:52 UTC, Igor Shirkalin 
wrote:

That was preface.
Now I have server written in D for C++ pretty ancient client. 
Most things are three times shorter in size and clear (@clear? 
suffix). All programming paradigms were used.
I have the same text in russian, but who has bothered 
russian(s)?
The meaning of all of that is: powerfull attractive language 
with sufficient infrastructure with future. Just use it.


p.s. I'm excused for my primitive english.


how much money did you earn using D language?
I didnt count, but its about ten thousend a year, i.e. nothing. 
You earn ten times more of me. Ask me enything more.




Re: The order of libraries makes error in dub

2016-12-05 Thread unDEFER via Digitalmars-d-learn

On Monday, 5 December 2016 at 15:16:27 UTC, unDEFER wrote:
2) Its put to linker command at the first "libdb53d.lib 
WS2_32.lib" and AFTER that -m32mscoff. As result "cannot open 
file".


Oh, the reason was mistype. And I have found how-to hide linker 
warning ("lflags-windows": ["/NODEFAULTLIB:LIBCMTD"]).


Full correct dub.json:
===
{
"name": "bdb2d",
"targetName": "db",
"targetType": "library",
"description": "BerkeleyDB to D bindings.",
"authors": ["Nikolay (unDEFER) Krivchenkov"],
"homepage": "http://unde.su;,
"license": "GPL-3.0 or later",
"libs-posix": ["db"],
"libs-windows-dmd": ["libdb53sd", "WS2_32"],
"dflags-windows": ["-m32mscoff"],
"lflags-windows": ["/NODEFAULTLIB:LIBCMTD"],

"subPackages": [
{
"name": "reader",
"description": "BerkeleyDB Transaction test. Reader",
"targetName": "reader",
"targetType": "executable",
"sourceFiles": ["transactions_test/reader.d"],
"targetPath": "transactions_test",
"dependencies": {
"bdb2d": "*"
}
}, {
"name": "writer",
"description": "BerkeleyDB Transaction test. Writer",
"targetName": "writer",
"targetType": "executable",
"sourceFiles": ["transactions_test/writer.d"],
"targetPath": "transactions_test",
"dependencies": {
"bdb2d": "*"
}
}
]
}


Thank you to all, the thread is closed.


Re: The order of libraries makes error in dub

2016-12-05 Thread unDEFER via Digitalmars-d-learn

On Monday, 5 December 2016 at 14:59:26 UTC, Mike Parker wrote:

"libs-windows-dmd":["libdb53d.lib","ws2_32.lib"]


I have used "sourceFiles-windows-dmd", because it is the single 
that I could find.
Thank you, "libs-windows-dmd":["libdb53d","WS2_32"] works much 
better, but again these errors:

1) Its put to linker command "db.lib" from libs-posix
2) Its put to linker command at the first "libdb53d.lib 
WS2_32.lib" and AFTER that -m32mscoff. As result "cannot open 
file".


Re: The order of libraries makes error in dub

2016-12-05 Thread rikki cattermole via Digitalmars-d-learn

On 06/12/2016 3:59 AM, Mike Parker wrote:

snip


Also, let's be clear here, the errors you saw above are linker errors,
not DUB errors. This one in particular is very common on Windows when
using the MS linker:

warning LNK4098: defaultlib 'LIBCMTD' conflicts with use of other libs;
use /NODEFAULTLIB:library

It's normally because you're linking in libs compiled against different
versions of the C standard library. Google should help you out there.


Or in unDEFERS case, Cygwin and dmc's (which is 100% against Cygwin's 
design).


Re: The order of libraries makes error in dub

2016-12-05 Thread Mike Parker via Digitalmars-d-learn

On Monday, 5 December 2016 at 14:29:42 UTC, unDEFER wrote:

On Monday, 5 December 2016 at 11:51:52 UTC, unDEFER wrote:


"libs-posix": ["db"],
"sourceFiles-windows-dmd": ["libdb53d.lib", "WS_32.LIB"],
"dflags-windows": ["-m32mscoff"],

"subPackages": [



I understand that I don't must add "sourceFiles-windows-dmd" to 
lib project, I must add it to subPackages, but dub places the 
names of lib BEFORE -m32mscoff. So it doesn't work.

Say me: dub for windows not ready??


DUB works on Windows just fine. My question is, why are you 
passing libraries in the sourceFiles field? Why not:


"libs-windows-dmd":["libdb53d.lib","ws2_32.lib"]

Does that make a difference?

Also, let's be clear here, the errors you saw above are linker 
errors, not DUB errors. This one in particular is very common on 
Windows when using the MS linker:


warning LNK4098: defaultlib 'LIBCMTD' conflicts with use of other 
libs; use /NODEFAULTLIB:library


It's normally because you're linking in libs compiled against 
different versions of the C standard library. Google should help 
you out there.


Re: The order of libraries makes error in dub

2016-12-05 Thread unDEFER via Digitalmars-d-learn

On Monday, 5 December 2016 at 11:51:52 UTC, unDEFER wrote:


"libs-posix": ["db"],
"sourceFiles-windows-dmd": ["libdb53d.lib", "WS_32.LIB"],
"dflags-windows": ["-m32mscoff"],

"subPackages": [



I understand that I don't must add "sourceFiles-windows-dmd" to 
lib project, I must add it to subPackages, but dub places the 
names of lib BEFORE -m32mscoff. So it doesn't work.

Say me: dub for windows not ready??




The order of libraries makes error in dub

2016-12-05 Thread unDEFER via Digitalmars-d-learn
Hello, dub makes string like the next to compile my program 
(WS_32.LIB at the beginning):


$ dmd -m32mscoff -lib 
-of.dub\\build\\library-debug-windows-x86-dmd_2072-83D2723917096513EB360761C22DDD87\\db.lib -debug -g -w -version=Have_bdb2d WS_32.LIB libdb53d.lib source/berkeleydb/* -vcolumns

Error: Error reading file 'WS_32.LIB'

So it shows error.

In other order (libraries at the end):
$ dmd -m32mscoff -lib 
-of.dub\\build\\library-debug-windows-x86-dmd_2072-83D2723917096513EB360761C22DDD87\\db.lib -debug -g -w -version=Have_bdb2d -Isource source/berkeleydb/* libdb53sd.lib WS2_32.LIB -vcolumns


No error.

But (again WS_32.LIB at beginning):
$ dmd -m32mscoff WS2_32.LIB libdb53sd.lib 
transactions_test/writer source/berkeleydb/*
LINK : warning LNK4098: defaultlib 'LIBCMTD' conflicts with use 
of other libs; use /NODEFAULTLIB:library


Again no error, only warning.

How to make with dub correct compilable compile line?

my dub.json:
===
{
"name": "bdb2d",
"targetName": "db",
"targetType": "library",
"description": "BerkeleyDB to D bindings.",
"authors": ["Nikolay (unDEFER) Krivchenkov"],
"homepage": "http://unde.su;,
"license": "GPL-3.0 or later",
"libs-posix": ["db"],
"sourceFiles-windows-dmd": ["libdb53d.lib", "WS_32.LIB"],
"dflags-windows": ["-m32mscoff"],

"subPackages": [
{
"name": "reader",
"description": "BerkeleyDB Transaction test. Reader",
"targetName": "reader",
"targetType": "executable",
"sourceFiles": ["transactions_test/reader.d"],
"targetPath": "transactions_test",
"dependencies": {
"bdb2d": "*"
}
}, {
"name": "writer",
"description": "BerkeleyDB Transaction test. Writer",
"targetName": "writer",
"targetType": "executable",
"sourceFiles": ["transactions_test/writer.d"],
"targetPath": "transactions_test",
"dependencies": {
"bdb2d": "*"
}
}
]
}
==


Re: How to use library compiled with Microsoft Visual Studio 2015 in D?

2016-12-05 Thread unDEFER via Digitalmars-d-learn
OK, I have found. It must be library WS2_32.LIB from Microsoft 
SDK. But dumpbin doesn't show __imp__htonl@4 symbol there. The 
magic!

Thank you!


Re: How to use library compiled with Microsoft Visual Studio 2015 in D?

2016-12-05 Thread unDEFER via Digitalmars-d-learn

On Monday, 5 December 2016 at 07:21:30 UTC, Jacob Carlborg wrote:
If you compile your D code with the "-m32mscoff" flag it will 
produce COFF objects and use the Visual Studio tool chain 
(linker and runtime). Compiling for 64bit (-m64) will always 
produce COFF objects.


Big thanks! -m32mscoff is great!
But now I have the problem of unresolved external symbols, e.g. 
"__imp__htonl@4".
What I'm doing? I'm going to Microsoft Visual Studio directory 
and run the script:
$ for i in `/bin/find.exe . -iname "*.lib"`; do bin/dumpbin 
/SYMBOLS $i | /bin/grep __imp__htonl@4 && echo $i; done

308  UNDEF  notype   External | __imp__htonl@4
./atlmfc/lib/nafxcw.lib
3C6  UNDEF  notype   External | __imp__htonl@4
./atlmfc/lib/nafxcwd.lib
332  UNDEF  notype   External | __imp__htonl@4
./atlmfc/lib/uafxcw.lib
3D6  UNDEF  notype   External | __imp__htonl@4
./atlmfc/lib/uafxcwd.lib

Try to link with found libraries, but it doesn't work. The 
symbols still unresolved.

What I'm doing wrong?