Re: Using C library libsndfile with D

2015-06-25 Thread Kadir Erdem Demir via Digitalmars-d-learn
D has the pragma(lib) feature where you can tell the compiler to link with a specific library as well. For example: pragma(lib, "curl"); I want to try that as soon as I get home from work. You probably need to make a .lib file from the dll too. The implib program does that. If you don't

Re: compile shared lib with dub

2015-06-25 Thread dom via Digitalmars-d-learn
ok i actually did everything right x3 ... but my code threw some warnings which are interpreted as errors by default. /solved

compile shared lib with dub

2015-06-25 Thread dom via Digitalmars-d-learn
i want to build a shared library (.so) with dub. currently i compile with a shell script, but i'd like to use dub [code] dmd -c test.d -fPIC dmd -ofcod4xalicebridge.so test.o -shared -g -w -debug -version=Have_cod4xalicebridge [/code] could anyone tell me how my dub.json has to look like? my

Re: Typed Message Passing between D Processes

2015-06-25 Thread Laeeth Isharc via Digitalmars-d-learn
On Thursday, 25 June 2015 at 14:04:23 UTC, Per Nordlöw wrote: Is there an alternative to http://dlang.org/phobos/std_process.html#.pipe that can be used to do _typed_ _message_ _passing_ between two D processes with the same convenience as `send` and `receive` in std.concurrency ? Either i

Re: Using C library libsndfile with D

2015-06-25 Thread tcak via Digitalmars-d-learn
On Thursday, 25 June 2015 at 19:54:34 UTC, Ali Çehreli wrote: On 06/25/2015 12:51 PM, bachmeier wrote: pragma(lib, "sndfile"); This is the first time I've heard of pragma(lib). It's a nice feature that should be added to the compiler documentation. They are all here: http://dlang.or

Re: Importing local modules in C style

2015-06-25 Thread jmh530 via Digitalmars-d-learn
On Thursday, 25 June 2015 at 17:20:46 UTC, jmh530 wrote: On Thursday, 25 June 2015 at 14:37:28 UTC, Binarydepth wrote: I organize some exercises in some source files, it's more how I like to work with C. I'm used to organize source files this way and I was wondering if this was possible with

Re: Using C library libsndfile with D

2015-06-25 Thread Adam D. Ruppe via Digitalmars-d-learn
You probably need to make a .lib file from the dll too. The implib program does that. If you don't have it, if you wanna email me the libsoundfile.dll program, I'll run it and make the .lib for you.

Re: Using C library libsndfile with D

2015-06-25 Thread bachmeier via Digitalmars-d-learn
On Thursday, 25 June 2015 at 19:54:40 UTC, Steven Schveighoffer wrote: http://dlang.org/pragma.html#lib It's got some problems though. Not everyone's system is the same. -Steve Okay. Then I guess it should not be pushed.

Re: Using C library libsndfile with D

2015-06-25 Thread bachmeier via Digitalmars-d-learn
On Thursday, 25 June 2015 at 19:54:34 UTC, Ali Çehreli wrote: They are all here: http://dlang.org/pragma.html pragma(inline) is the latest, which will be available in 2.068. Ali I meant on this page: http://dlang.org/dmd-linux.html Someone starting out with D might not look at the pragma

Re: Using C library libsndfile with D

2015-06-25 Thread Ali Çehreli via Digitalmars-d-learn
On 06/25/2015 12:51 PM, bachmeier wrote: pragma(lib, "sndfile"); This is the first time I've heard of pragma(lib). It's a nice feature that should be added to the compiler documentation. They are all here: http://dlang.org/pragma.html pragma(inline) is the latest, which will be availa

Re: Using C library libsndfile with D

2015-06-25 Thread Steven Schveighoffer via Digitalmars-d-learn
On 6/25/15 3:51 PM, bachmeier wrote: On Thursday, 25 June 2015 at 18:29:23 UTC, Ali Çehreli wrote: D has the pragma(lib) feature where you can tell the compiler to link with a specific library as well. For example: pragma(lib, "curl"); You would probably use "sndfile" in your case (not sure

Re: Using C library libsndfile with D

2015-06-25 Thread bachmeier via Digitalmars-d-learn
On Thursday, 25 June 2015 at 18:29:23 UTC, Ali Çehreli wrote: D has the pragma(lib) feature where you can tell the compiler to link with a specific library as well. For example: pragma(lib, "curl"); You would probably use "sndfile" in your case (not sure): pragma(lib, "sndfile"); This

Re: Abstract sockets (linux)

2015-06-25 Thread Ali Çehreli via Digitalmars-d-learn
On 06/25/2015 08:56 AM, freeman wrote: I am having trouble using abstract sockets on Linux. Here is sample python code that works, which works: ptm_sockname = "\0/var/run/ptmd.socket" sock = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM) sock.connect(ptm_sockname) sock.set

Re: Abstract sockets (linux)

2015-06-25 Thread freeman via Digitalmars-d-learn
On Thursday, 25 June 2015 at 18:50:29 UTC, Daniel Kozak wrote: Any pointers? instead of: string socket_name = "\0/var/run/ptmd.socket"; try: string socket_name = "/var/run/ptmd.socket"; works for me It is the null character that makes it an abstract socket (see man unix). There is no file /

Re: Compiler complaining about code that can't be reached, builtin types .equals()

2015-06-25 Thread Sean Grimes via Digitalmars-d-learn
On Thursday, 25 June 2015 at 18:43:31 UTC, Ali Çehreli wrote: On 06/25/2015 11:26 AM, Sean Grimes wrote: Here is a short example which treats 'int' and 'double' as built-in only: import std.typetuple; bool isBuiltIn(T)() { foreach (T2; TypeTuple!(int, double/*, ... */)) { if (is

Re: Abstract sockets (linux)

2015-06-25 Thread Daniel Kozak via Digitalmars-d-learn
On Thu, 25 Jun 2015 15:56:04 + freeman via Digitalmars-d-learn wrote: > I am having trouble using abstract sockets on Linux. > > Here is sample python code that works, which works: > ptm_sockname = "\0/var/run/ptmd.socket" > sock = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)

Re: Compiler complaining about code that can't be reached, builtin types .equals()

2015-06-25 Thread Ali Çehreli via Digitalmars-d-learn
On 06/25/2015 11:26 AM, Sean Grimes wrote: > /* >* isBuiltIn() checks against all the builtin types in D >* returns true if value instantiated as int, double, > immutable(char)[] etc... >* returns false iff value is a user defined object >*/ > if(!isBuil

Re: Using C library libsndfile with D

2015-06-25 Thread Ali Çehreli via Digitalmars-d-learn
On 06/25/2015 11:12 AM, kerdemdemir wrote: > I downloaded the project from. > https://github.com/D-Programming-Deimos/libsndfile > > I add the sndfile.di file to my project. > > I thought I could directly use libsndfile.dll since D directly supports > C. But I am getting link errors. Bindings a

Compiler complaining about code that can't be reached, builtin types .equals()

2015-06-25 Thread Sean Grimes via Digitalmars-d-learn
I have a method, containsValue() in a class similar to java.util.HashMap. The class is a template class, instantiated with 2 parameters, K key, V value. bool containsValue(V value){ // dlang associative array, .values returns dynamic array of values in the aa auto values = this.inter

Using C library libsndfile with D

2015-06-25 Thread kerdemdemir via Digitalmars-d-learn
Hi I want to read wav files. I thought I can use libsndfile since I am quite familiar with it. I downloaded the project from. https://github.com/D-Programming-Deimos/libsndfile I add the sndfile.di file to my project. I thought I could directly use libsndfile.dll since D directly supports

Re: Check if template has been passed a reference type or value type?

2015-06-25 Thread Gary Willoughby via Digitalmars-d-learn
On Sunday, 7 June 2015 at 15:17:27 UTC, 1967 wrote: I've got a template that takes in a type. Sometimes the type is a class, sometimes a struct, sometimes just an int. It doesn't much matter what it is, but if it's a reference type I need to check if it's null so I can make it not null before u

Re: Importing local modules in C style

2015-06-25 Thread jmh530 via Digitalmars-d-learn
On Thursday, 25 June 2015 at 14:37:28 UTC, Binarydepth wrote: I organize some exercises in some source files, it's more how I like to work with C. I'm used to organize source files this way and I was wondering if this was possible with D. If the files are in the same folder, just import lo

Re: Abstract sockets (linux)

2015-06-25 Thread freeman via Digitalmars-d-learn
On Thursday, 25 June 2015 at 16:07:51 UTC, Steven Schveighoffer wrote: I believe there was a recently fixed bug regarding unix sockets. The upcoming 2.068 may help, have you tried the beta? http://downloads.dlang.org/pre-releases/2.x/2.068.0/ -Steve Unfortunately the problem persists (I was

Re: Abstract sockets (linux)

2015-06-25 Thread Steven Schveighoffer via Digitalmars-d-learn
On 6/25/15 11:56 AM, freeman wrote: I am having trouble using abstract sockets on Linux. Here is sample python code that works, which works: ptm_sockname = "\0/var/run/ptmd.socket" sock = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM) sock.connect(ptm_sockname) sock.setblo

Abstract sockets (linux)

2015-06-25 Thread freeman via Digitalmars-d-learn
I am having trouble using abstract sockets on Linux. Here is sample python code that works, which works: ptm_sockname = "\0/var/run/ptmd.socket" sock = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM) sock.connect(ptm_sockname) sock.setblocking(1) sock.sendall('get-status det

Re: Importing local modules in C style

2015-06-25 Thread Steven Schveighoffer via Digitalmars-d-learn
On 6/25/15 10:37 AM, Binarydepth wrote: On Thursday, 25 June 2015 at 14:10:00 UTC, Steven Schveighoffer wrote: On 6/25/15 9:57 AM, Binarydepth wrote: I want to import a module from my local project in C style (#include "local.h"). No. I know I can do "dmd main.d local.d" but I wonder if i

Re: Importing local modules in C style

2015-06-25 Thread Binarydepth via Digitalmars-d-learn
On Thursday, 25 June 2015 at 14:10:00 UTC, Steven Schveighoffer wrote: On 6/25/15 9:57 AM, Binarydepth wrote: I want to import a module from my local project in C style (#include "local.h"). No. I know I can do "dmd main.d local.d" but I wonder if it can be done C style. What is your

Re: function default parameters lost

2015-06-25 Thread Paul D Anderson via Digitalmars-d-learn
On Thursday, 25 June 2015 at 07:10:57 UTC, tcak wrote: On Thursday, 25 June 2015 at 04:43:51 UTC, Paul D Anderson wrote: I'm trying to pass a function pointer while keeping the default parameter values intact. Given the following: [...] I filed a bug about 2-3 months ago about default parame

Re: Opening browser and url.

2015-06-25 Thread Bauss via Digitalmars-d-learn
On Thursday, 25 June 2015 at 14:05:54 UTC, MrSmith wrote: On Thursday, 25 June 2015 at 14:02:41 UTC, Bauss wrote: In other programming languages you can open a website in the default browser by spawning a process using the url, but it does not seem to work with D using spawnProcess(). Do I ha

Re: Opening browser and url.

2015-06-25 Thread MrSmith via Digitalmars-d-learn
On Thursday, 25 June 2015 at 14:02:41 UTC, Bauss wrote: In other programming languages you can open a website in the default browser by spawning a process using the url, but it does not seem to work with D using spawnProcess(). Do I have to do API calls to get the default browser and then cal

Re: Importing local modules in C style

2015-06-25 Thread Steven Schveighoffer via Digitalmars-d-learn
On 6/25/15 9:57 AM, Binarydepth wrote: I want to import a module from my local project in C style (#include "local.h"). No. I know I can do "dmd main.d local.d" but I wonder if it can be done C style. What is your goal? Why doesn't D import work for you? -Steve

Typed Message Passing between D Processes

2015-06-25 Thread via Digitalmars-d-learn
Is there an alternative to http://dlang.org/phobos/std_process.html#.pipe that can be used to do _typed_ _message_ _passing_ between two D processes with the same convenience as `send` and `receive` in std.concurrency ? Either in Phobos or in a third party library?

Opening browser and url.

2015-06-25 Thread Bauss via Digitalmars-d-learn
In other programming languages you can open a website in the default browser by spawning a process using the url, but it does not seem to work with D using spawnProcess(). Do I have to do API calls to get the default browser and then call spawnProcess() with the url as an argument or is there

Importing local modules in C style

2015-06-25 Thread Binarydepth via Digitalmars-d-learn
I want to import a module from my local project in C style (#include "local.h"). I know I can do "dmd main.d local.d" but I wonder if it can be done C style. Thank you BD

Re: function default parameters lost

2015-06-25 Thread tcak via Digitalmars-d-learn
On Thursday, 25 June 2015 at 04:43:51 UTC, Paul D Anderson wrote: I'm trying to pass a function pointer while keeping the default parameter values intact. Given the following: [...] I filed a bug about 2-3 months ago about default parameters similar to yours. My guess is that it hasn't been