Using PyD

2017-11-21 Thread sivakon via Digitalmars-d-learn
I can create a python project by creating a PyDobject and `python setup.py install` and get the output. If I want to add an external library in D (usually I do that with `dub run --single` command), how do I accomplish that? In the project below, if I want to use some D libraries, how do I b

interfacing c++

2017-11-21 Thread Markus via Digitalmars-d-learn
hi, im trying to interface a cpp class. I'd like to interface a bigger library and I'm trying to figure out the minimum effort. --- c++ part: #include class some_class { public: static some_class* __ctor(); some_class(); ~some_class(); void some_method(); }; some_class* some_class::__ct

Re: Visual D >> TRACKER : error TRK0004: Failed to locate: "FileTracker32.dll". The system cannot find the file specified.

2017-11-21 Thread A Guy With a Question via Digitalmars-d-learn
On Tuesday, 21 November 2017 at 04:39:52 UTC, A Guy With a Question wrote: I'm trying to learn D using Visual D in Visual Studio Community 2015. Both dmd and ldc give me this error when building from Visual Studio. Any ideas? I'm able to build C++ projects... So I figured this one out. I set m

Re: String copying fails when output from assert

2017-11-21 Thread H. S. Teoh via Digitalmars-d-learn
On Tue, Nov 21, 2017 at 12:05:21PM -0700, Jonathan M Davis via Digitalmars-d-learn wrote: > On Tuesday, November 21, 2017 18:49:40 David Zhang via Digitalmars-d-learn > wrote: [...] > > char[64] chars; > > chars[0..str.length] = str; > > assert(false, chars[0..str.length]); [...] > Well, th

Re: String copying fails when output from assert

2017-11-21 Thread Jonathan M Davis via Digitalmars-d-learn
On Tuesday, November 21, 2017 19:13:36 David Zhang via Digitalmars-d-learn wrote: > On Tuesday, 21 November 2017 at 19:05:21 UTC, Jonathan M Davis > > wrote: > > Well, the assertion is going to throw an AssertError, which > > takes a string for its message. It doesn't copy the contents of > > the

Re: dmd/ldc failed with exit code -11

2017-11-21 Thread Anonymouse via Digitalmars-d-learn
On Tuesday, 21 November 2017 at 13:28:44 UTC, Anonymouse wrote: Looking at the dmd command dub issues and testing them myself I notice that if I reorder the arguments it builds. $ dmd -d -oftest source/arsd/*.d source/kameloso/plugins/*.d source/kameloso/*.d zsh: segmentation fault (core dumpe

Re: String copying fails when output from assert

2017-11-21 Thread Jonathan M Davis via Digitalmars-d-learn
On Tuesday, November 21, 2017 18:59:14 David Zhang via Digitalmars-d-learn wrote: > On Tuesday, 21 November 2017 at 18:56:03 UTC, Adam D. Ruppe wrote: > > On Tuesday, 21 November 2017 at 18:49:40 UTC, David Zhang > > > > wrote: > >>assert(false, chars[0..str.length]); > >> > >> } > >> > >> Wh

Re: String copying fails when output from assert

2017-11-21 Thread Jonathan M Davis via Digitalmars-d-learn
On Tuesday, November 21, 2017 12:05:21 Jonathan M Davis via Digitalmars-d- learn wrote: > On Tuesday, November 21, 2017 18:49:40 David Zhang via Digitalmars-d-learn > wrote: > > Hi, > > > > I've been trying to copy a string, then output it from an > > `assert(false)` statement, but the copy seems t

Re: String copying fails when output from assert

2017-11-21 Thread David Zhang via Digitalmars-d-learn
On Tuesday, 21 November 2017 at 19:05:21 UTC, Jonathan M Davis wrote: Well, the assertion is going to throw an AssertError, which takes a string for its message. It doesn't copy the contents of the string. It's just taking a slice just like whenever you pass a string to any other function. So,

Re: String copying fails when output from assert

2017-11-21 Thread Jonathan M Davis via Digitalmars-d-learn
On Tuesday, November 21, 2017 18:49:40 David Zhang via Digitalmars-d-learn wrote: > Hi, > > I've been trying to copy a string, then output it from an > `assert(false)` statement, but the copy seems to be corrupted > somehow. > > void main() > { > string str = "some string"; > > //initia

Re: String copying fails when output from assert

2017-11-21 Thread David Zhang via Digitalmars-d-learn
On Tuesday, 21 November 2017 at 18:56:03 UTC, Adam D. Ruppe wrote: On Tuesday, 21 November 2017 at 18:49:40 UTC, David Zhang wrote: assert(false, chars[0..str.length]); } What am I missing here? You're escaping a reference to a local variable there. chars[] is a pointer to the stack

Re: String copying fails when output from assert

2017-11-21 Thread Adam D. Ruppe via Digitalmars-d-learn
On Tuesday, 21 November 2017 at 18:49:40 UTC, David Zhang wrote: assert(false, chars[0..str.length]); } What am I missing here? You're escaping a reference to a local variable there. chars[] is a pointer to the stack, which is promptly smashed when the assert error starts working up

String copying fails when output from assert

2017-11-21 Thread David Zhang via Digitalmars-d-learn
Hi, I've been trying to copy a string, then output it from an `assert(false)` statement, but the copy seems to be corrupted somehow. void main() { string str = "some string"; //initializing `chars` with any value doesn't do anything char[64] chars; //char[64]

Re: dub: Use Alternate Dependency

2017-11-21 Thread jmh530 via Digitalmars-d-learn
On Tuesday, 21 November 2017 at 07:36:25 UTC, drug wrote: Probably author needs the following: dependency "package" version="*" path="../relative/path/to/other/custom/package" instead of dependency "package" version="~>1.2.3" this allows using custom package not registered on dub and after d

Mirroring a drawable buf in DLangUI?

2017-11-21 Thread Dukc via Digitalmars-d-learn
I am using the DrawRescaled method of DrawBuf[1] of DLangUI To draw a PNG image to a CanvasWidget[2] subclass. It has a minor issue of the box bounds showing in area that shoud be transparent but otherwise works well. My question is, does anybody know a way to draw that image backwards withou

Re: dmd/ldc failed with exit code -11

2017-11-21 Thread Anonymouse via Digitalmars-d-learn
On Tuesday, 21 November 2017 at 10:12:11 UTC, Petar Kirov [ZombineDev] wrote: On Tuesday, 21 November 2017 at 10:10:59 UTC, Petar Kirov [ZombineDev] wrote: On Tuesday, 21 November 2017 at 00:15:04 UTC, Anonymouse wrote: I have a large named enum (currently 645 members) of IRC event types. It's

Re: dmd/ldc failed with exit code -11

2017-11-21 Thread Anonymouse via Digitalmars-d-learn
On Tuesday, 21 November 2017 at 00:36:00 UTC, rikki cattermole wrote: Source code please. https://github.com/zorael/kameloso.git I'm not proud of some of the early bits there (main.d) so don't judge me, please. I'm learning as I go. The offending bits are IRCEvent.Type in ircstructs.d[1]. I

Re: Turn a float into a value between 0 and 1 (inclusive)?

2017-11-21 Thread Biotronic via Digitalmars-d-learn
On Tuesday, 21 November 2017 at 09:21:29 UTC, Chirs Forest wrote: I'm interpolating some values and I need to make an (elapsed_time/duration) value a float between 0 and 1 (inclusive of 0 and 1). The elapsed_time might be more than the duration, and in some cases might be 0 or less. What's the

Re: dmd/ldc failed with exit code -11

2017-11-21 Thread Petar via Digitalmars-d-learn
On Tuesday, 21 November 2017 at 10:10:59 UTC, Petar Kirov [ZombineDev] wrote: On Tuesday, 21 November 2017 at 00:15:04 UTC, Anonymouse wrote: I have a large named enum (currently 645 members) of IRC event types. It's big by neccessity[1]. I'm using dub, and both dmd and ldc successfully build

Re: dmd/ldc failed with exit code -11

2017-11-21 Thread Petar via Digitalmars-d-learn
On Tuesday, 21 November 2017 at 00:15:04 UTC, Anonymouse wrote: I have a large named enum (currently 645 members) of IRC event types. It's big by neccessity[1]. I'm using dub, and both dmd and ldc successfully build it in test and debug modes, but choke and die on plain and release. I bisecte

Re: DMD test suite assertion failure in test_cdvecfill.d

2017-11-21 Thread Petar via Digitalmars-d-learn
On Tuesday, 21 November 2017 at 07:02:20 UTC, Michael V. Franklin wrote: I'm getting this error when I try to run the DMD test suite. cd dmd make -C test -f Makefile [...] I don't think you're doing anything wrong, though you shouldn't be getting that error. File a bug report and try contact

Re: Turn a float into a value between 0 and 1 (inclusive)?

2017-11-21 Thread Petar via Digitalmars-d-learn
On Tuesday, 21 November 2017 at 09:53:33 UTC, Petar Kirov [ZombineDev] wrote: On Tuesday, 21 November 2017 at 09:21:29 UTC, Chirs Forest wrote: I'm interpolating some values and I need to make an (elapsed_time/duration) value a float between 0 and 1 (inclusive of 0 and 1). The elapsed_time migh

Re: Turn a float into a value between 0 and 1 (inclusive)?

2017-11-21 Thread Petar via Digitalmars-d-learn
On Tuesday, 21 November 2017 at 09:21:29 UTC, Chirs Forest wrote: I'm interpolating some values and I need to make an (elapsed_time/duration) value a float between 0 and 1 (inclusive of 0 and 1). The elapsed_time might be more than the duration, and in some cases might be 0 or less. What's the

Turn a float into a value between 0 and 1 (inclusive)?

2017-11-21 Thread Chirs Forest via Digitalmars-d-learn
I'm interpolating some values and I need to make an (elapsed_time/duration) value a float between 0 and 1 (inclusive of 0 and 1). The elapsed_time might be more than the duration, and in some cases might be 0 or less. What's the most efficient way to cap out of bounds values to 0 and 1? I can d