Re: Linking to Dynamic Library on Mac OS X

2015-05-16 Thread TJB via Digitalmars-d-learn
On Friday, 15 May 2015 at 19:49:30 UTC, John Colvin wrote: On Friday, 15 May 2015 at 19:39:53 UTC, TJB wrote: Off the top of my head: does adding -L-L$(pwd) help? This is what I get: $ dmd main.d -L-L$(pwd) -lhello Error: unrecognized switch '-lhello' Sorry if this is completely elementary

Re: Linking to Dynamic Library on Mac OS X

2015-05-15 Thread TJB via Digitalmars-d-learn
Off the top of my head: does adding -L-L$(pwd) help? This is what I get: $ dmd main.d -L-L$(pwd) -lhello Error: unrecognized switch '-lhello' Sorry if this is completely elementary and I am being quite dumb. Thanks, TJB

Linking to Dynamic Library on Mac OS X

2015-05-14 Thread TJB via Digitalmars-d-learn
I have built a toy dynamic shared library on Mac OS X (in C), and I have verified that it works from C. Now I would like to call it from D. So I have created the following interface file: $ cat hello.di extern (C): void printHelloWorld(); which I try to compile and run. But I get the

Binding to C

2015-05-11 Thread TJB via Digitalmars-d-learn
I'm sure this question has been asked a thousand times. I've even asked similar questions in the past (I've been away for quite a while). But all of the tutorials that I have found assume quite a lot and leave a lot to be inferred. Is there a simple step by step tutorial demonstrating how to

Re: CSV Data to Binary File

2014-08-07 Thread TJB via Digitalmars-d-learn
On Thursday, 7 August 2014 at 15:11:48 UTC, TJB wrote: I am trying to read data in from a csv file into a struct, and then turn around and write that data to binary format. Here is my code: import std.algorithm; import std.csv; import stdio = std.stdio; import std.stream; align(1) struct

CSV Data to Binary File

2014-08-07 Thread TJB via Digitalmars-d-learn
I am trying to read data in from a csv file into a struct, and then turn around and write that data to binary format. Here is my code: import std.algorithm; import std.csv; import stdio = std.stdio; import std.stream; align(1) struct QuotesBin { int qtim;9 int bid; int ofr; int

Max/Min values in an associative array

2014-08-06 Thread TJB via Digitalmars-d-learn
I am trying to find the max and min values in an associative array. Say I have: double[char] bids; bid['A'] = 37.50; bid['B'] = 38.11; bid['C'] = 36.12; How can I find the max and min values. I am thinking that I need to use max and min functions from std.algorithm, but not sure how to.

Re: Max/Min values in an associative array

2014-08-06 Thread TJB via Digitalmars-d-learn
Justin, That's it! Perfect - thanks!! TJB Do you just need the min and max values or do you also need the keys of those values? If the former, here's a paste: http://dpaste.dzfl.pl/0bbf31278a25

Re: Command Line Application in D

2014-08-05 Thread TJB via Digitalmars-d-learn
This is exactly what I was thinking. Thanks so much for your help! TJB Just a little something I made for you. Untested of course. But takes an argument from cli, which is a glob. Foreach file under current working directory, if its a file write out processing. (I gave std.stdio an alias

Command Line Application in D

2014-08-04 Thread TJB via Digitalmars-d-learn
I am trying to build some simple command line applications that I have written in python as a way to learn D. Can you give some examples for me? For instance, I think I remember once seeing somewhere in the documentation an example that took several D files and compiled them all by running

Re: Command Line Application in D

2014-08-04 Thread TJB via Digitalmars-d-learn
On Monday, 4 August 2014 at 21:58:09 UTC, maarten van damme via Digitalmars-d-learn wrote: I am a little bit confused as to what you want. There is a command line example at dlang.org, and there exists a program (rdmd) that compiles several D files and runs them. http://dlang.org/rdmd.html

Creating Libraries Callable from C

2014-04-26 Thread TJB via Digitalmars-d-learn
Is it possible to write a library that is callable from C without the enduser even knowing it was written in D? That is, can a C programmer use the library as though it were written in C straightforwardly? Or for that matter, by an enduser programming in Python or Lua where the library is