Re: Noob ImportC questions

2025-02-27 Thread John C. via Digitalmars-d-learn
On Thursday, 27 February 2025 at 13:33:55 UTC, John C. wrote: all code I have tested worked perfectly. Of course, I had to rewrite all "RAYWHITE" to "raywhite", etc., but I'm happy to have working GUI library now!

Re: Noob ImportC questions

2025-02-27 Thread John C. via Digitalmars-d-learn
On Thursday, 27 February 2025 at 12:48:19 UTC, Kapendev wrote: On Thursday, 27 February 2025 at 08:16:33 UTC, John C. wrote: On Thursday, 27 February 2025 at 08:10:04 UTC, John C. wrote: But this change was not helpful, same error occured. Does this mean that ImportC cannot parse object

Re: Noob ImportC questions

2025-02-27 Thread John C. via Digitalmars-d-learn
On Wednesday, 26 February 2025 at 17:00:48 UTC, John C. wrote: 2. Why main.d version with "Color(...)" replaced by "RAYWHITE" or "LIGHTGREY" (defined in header) will not compile with "undefined identifier" error? I have tested some basic Raylib funct

Re: Noob ImportC questions

2025-02-27 Thread John C. via Digitalmars-d-learn
On Thursday, 27 February 2025 at 08:10:04 UTC, John C. wrote: would removing some "hard to parse" constructs in header file help this situation? I tried to change ``` #define LIGHTGRAY CLITERAL(Color){ 200, 200, 200, 255 } // Light Gray ``` To more simpler definition whic

Re: Noob ImportC questions

2025-02-27 Thread John C. via Digitalmars-d-learn
On Wednesday, 26 February 2025 at 18:53:40 UTC, Kapendev wrote: On Wednesday, 26 February 2025 at 17:00:48 UTC, John C. wrote: Error (with both commands above, same result): ``` main.d(8): Error: undefined identifier `RAYWHITE` main.d(9): Error: undefined identifier `LIGHTGRAY` ``` Both

Re: Noob ImportC questions

2025-02-26 Thread John C. via Digitalmars-d-learn
On Wednesday, 26 February 2025 at 21:08:19 UTC, monkyyy wrote: I think `import raylib` finds raylib.c Thank you, it were actually using raylib.c in both cases. When I renamed this file, import was made impossible (I think it should have happened?)

Noob ImportC questions

2025-02-26 Thread John C. via Digitalmars-d-learn
Hello everyone. Recently I get interested in some GUI-related stuff and I want to use Raylib in my project. I know about raylib-d, dray, etc. bindings, but I would like to see what can ImportC do for me in this situation. I have following project hierarchy: ``` project/ src/ main.d ra

Re: core.simd and dynamic arrays

2025-01-27 Thread John C. via Digitalmars-d-learn
On Monday, 27 January 2025 at 15:55:17 UTC, Guillaume Piolat wrote: You may use intel-intrinsics who: 1. guarantees float8 is there 2. have aligned malloc _mm_malloc I have heard about intel-intrinsics and it's really good idea to use it in my code, but I wanted to try some SIMD operations wit

Re: core.simd and dynamic arrays

2025-01-26 Thread John C. via Digitalmars-d-learn
On Monday, 27 January 2025 at 05:53:09 UTC, John C. wrote: Print out the pointer to `a[0]` to verify what the actual alignment is. If we look to output above, first line addresses are aligned to 32 bytes Except address with B(1011) at second from the right position?

Re: core.simd and dynamic arrays

2025-01-26 Thread John C. via Digitalmars-d-learn
ize_t)(arr + 32) & ~ 0x01F))[0..length]; } void main() { float[] a = initAlignedArr!float(1024); float[] b = initAlignedArr!float(1024); float[] c = initAlignedArr!float(1024); writeln(&a, " ", &b, " ", &c); writeln(a.ptr, " &quo

Re: core.simd and dynamic arrays

2025-01-26 Thread John C. via Digitalmars-d-learn
On Sunday, 26 January 2025 at 13:59:09 UTC, John C. wrote: I have tested this code with LDC on run.dlang.io, segmentation fault does occur only if -mattr=+avx is used. Without this flag no errors are produced. Actually, if I use -mcpu=avx with DMD, no error is generated. However, if this

Re: core.simd and dynamic arrays

2025-01-26 Thread John C. via Digitalmars-d-learn
On Sunday, 26 January 2025 at 12:45:11 UTC, John C. wrote: I'm using LDC compiler 1.36.0 on x86_64 Linux system with "-w -O3 -mattr=+avx" compiler flags. I have tested this code with LDC on run.dlang.io, segmentation fault does occur only if -mattr=+avx is used. Without this

Re: core.simd and dynamic arrays

2025-01-26 Thread John C. via Digitalmars-d-learn
On Sunday, 26 January 2025 at 12:56:55 UTC, ryuukk_ wrote: LDC 1.36 = 1 years old latest version is LDC 1.40 with LDC 1.40, your code works on my computer now my turn to ask a question: why were you using a 1 years old compiler version? common sense would be to make sure you are up to dat

core.simd and dynamic arrays

2025-01-26 Thread John C. via Digitalmars-d-learn
new float[128]; align(32) float[] c = new float[128]; /* filling input arrays with random numbers in [0, 1) range */ for (size_t i = 0; i < c.length; ++i) { a[i], b[i] = uniform01(), uniform01(); } for (size_t i = 0; i < c.length; i += 8) { /* seems that

Re: m32mscoff with lld-link causes SEH errors

2020-05-26 Thread Daniel C via Digitalmars-d-learn
On Tuesday, 26 May 2020 at 15:56:31 UTC, kinke wrote: Using `-L/safeseh:no` should work around this. It successfully made the executable, and it runs fine - until exit lol. Must be more tweaks needed. Edit source/app.d to start your project. object.Error@(0): Access Violation --

Re: m32mscoff with lld-link causes SEH errors

2020-05-26 Thread Daniel C via Digitalmars-d-learn
On Tuesday, 26 May 2020 at 15:56:31 UTC, kinke wrote: On Monday, 25 May 2020 at 01:32:58 UTC, Daniel C wrote: Is lld-link only for 64-bit compiles (-m64 is the only one that gives no errors) Nope, but SafeSEH is a 32-bit-only feature. DMD doesn't emit SafeSEH compatible object files, an

m32mscoff with lld-link causes SEH errors

2020-05-24 Thread Daniel C via Digitalmars-d-learn
Hi, I have a simple program with just one line (below). I've compiled on Windows using dmd -ms32coff app.d and have had LINKCMD set to lld-link, but get the following errors. Is lld-link only for 64-bit compiles (-m64 is the only one that gives no errors) lld-link: error: /safeseh: app.obj i

Re: returning struct, destructor

2016-12-21 Thread John C via Digitalmars-d-learn
On Wednesday, 21 December 2016 at 11:45:18 UTC, Eugene Wissner wrote: This prints 3 times "Destruct" with dmd 0.072.1. If I remove the if block, it prints "Destruct" only 2 times - the behavior I'm expecting. Why? Possibly to do with named return value optimisation.

Re: Proper generic way to get the hash of something?

2016-12-04 Thread John C via Digitalmars-d-learn
On Sunday, 4 December 2016 at 06:51:24 UTC, Tofu Ninja wrote: So what is the proper way to get the hash of something now? This question came up a few days ago: http://forum.dlang.org/post/o1igoc$21ma$1...@digitalmars.com

Returning structs from COM

2016-12-03 Thread John C via Digitalmars-d-learn
returns by value: interface ID2D1Bitmap : ID2D1Image { void GetSize(D2D1_SIZE_F* size); final D2D1_SIZE_F GetSize() { D2D1_SIZE_F size; GetSize(&size); return size; } } But does anyone know why the original definition works in C++ but not D? Is it a bug?

Re: problem with isnan

2016-11-11 Thread John C via Digitalmars-d-learn
On Friday, 11 November 2016 at 20:55:52 UTC, Charles Hixson wrote: Thank you. Unfortunately: importstd.math; ... assert(isNan (c.curActivation), "cell has unexpected curActivation: %s".format(c.curActivation)); yields: cell.d(292): Error: undefined identifier 'isNan', did

Re: Error 42 When Trying to Interop with a C# Libary

2016-11-05 Thread John C via Digitalmars-d-learn
On Saturday, 5 November 2016 at 21:02:14 UTC, Adam D. Ruppe wrote: coff2omf works with .obj files Well, that's not what the docs say! http://www.digitalmars.com/ctg/coff2omf.html "The input files can be either object files (.obj) or library files (.lib)" Apparently you have to convert t

Re: Error 42 When Trying to Interop with a C# Libary

2016-11-05 Thread John C via Digitalmars-d-learn
On Saturday, 5 November 2016 at 16:13:18 UTC, Sarcross wrote: If you're wondering, I did use the COFF2OMF tool on the library I got from the C# code, which is why in WordFileParser.d you'll see "pragma(lib, "Parser2")". I have never had success trying to link

Re: Unresolved Symbols in a nanovg Library

2016-10-26 Thread Jason C. Wells via Digitalmars-d-learn
more. Oh and, as the end user, that demo has me all impressed. :) Regards, Jason C. Wells

Re: Unresolved Symbols in a nanovg Library

2016-10-26 Thread Jason C. Wells via Digitalmars-d-learn
BTW, I am not ignoring you guys when I haven't used rdmd ( I tried briefly but got stuck) or specifying all *.d files on the command line (did that with some success). My learning process is very organic and trial and error. I appreciate what you are doing for me. Thanks for the invite to cha

Re: Unresolved Symbols in a nanovg Library

2016-10-26 Thread Jason C. Wells via Digitalmars-d-learn
Adding iv\stb\ttf.d cleared up most of the remaining linker errors. While compiling iv\nanovg_demo\example.d I am left with: bin\example.obj(example) Error 42: Symbol Undefined _D2iv6nanovg3oui12__ModuleInfoZ bin\example.obj(example) Error 42: Symbol Undefined _D2iv6nanovg12__ModuleInfoZ ..

Unresolved Symbols in a nanovg Library

2016-10-26 Thread Jason C. Wells via Digitalmars-d-learn
and error to sort this out. I thought I'd let you guys chime in. Perhaps Ketmar intended to remove his copy of ttf.d from his repo? Regards, Jason C. Wells

Re: Module Name Resolution

2016-10-25 Thread Jason C. Wells via Digitalmars-d-learn
On Wednesday, 26 October 2016 at 05:46:30 UTC, ketmar wrote: this is a repository name. it is supposed to be named just "iv", and git names main directory by repository name if you are doing a simple clone. my bad, i should have made that clear. Ok. That helps.

Re: Module Name Resolution

2016-10-25 Thread Jason C. Wells via Digitalmars-d-learn
Suddenly it occurs to me that the module namespace and the filesystem namespace do not necessarily have a one for one match, even though they do by default. When one specifies all the D source files on the command line, any differences between the module namespace and the filesystem namespace a

Module Name Resolution

2016-10-25 Thread Jason C. Wells via Digitalmars-d-learn
I am reading through: https://dlang.org/spec/module.html. I'll soon be working through a previous example provided by Mike Parker. I am reading through Ketmar's iv.d/nanovg/package.d: module iv.nanovg; public import iv.nanovg.nanovg; This looks like three levels of hierarchy, but is it?

Re: How to get sqlite3.lib x64?

2016-10-24 Thread John C via Digitalmars-d-learn
lib sqlite3.dll /system -> Error message: Error(10): Error: cannot read DLL input file I have the MS Build tools installed, but the example from the SQLite site only shows, how to build a X86 dll file from the C source code but not how to build the X86_64 lib file for windows: cl sqlite3.c -lin

Re: Render SVG To Display And Update Periodically

2016-10-22 Thread Jason C. Wells via Digitalmars-d-learn
On Saturday, 22 October 2016 at 06:18:13 UTC, Mike Parker wrote: I think I can confidently assure you that you aren't running into any bugs here. Thanks for the confirmation. It helps me to learn. You've dived right into a multi-module projects without a full understanding of imports and link

Re: Render SVG To Display And Update Periodically

2016-10-22 Thread Jason C. Wells via Digitalmars-d-learn
Now I think I finally see where my hang up is. If B imports C, and A imports B and C, you still have to tell A where to find C. C doesn't go along for the ride with B. Stated another way, A doesn't look inside B to find C. Stated yet another way, B does not expose C to A. The

Re: Render SVG To Display And Update Periodically

2016-10-21 Thread Jason C. Wells via Digitalmars-d-learn
le nanovg.lib quite easily (from tips provided a few messages ago). It's when I try to compile the demo that I get stuck. Regards, Jason C. Wells

Re: Render SVG To Display And Update Periodically

2016-10-21 Thread Jason C. Wells via Digitalmars-d-learn
I've tinkered with what you proposed. In the process I've worked through a variety of errors and ended up doing things I don't think are a good solution like duplication directories so that a library can be found. Let me see if I understand how to piece together a build. Some combination of t

Re: Render SVG To Display And Update Periodically

2016-10-19 Thread Jason C. Wells via Digitalmars-d-learn
This is probably a general programming question. I'll follow up here since this thread is the inspiration for my current question. When attempting to compile simpledisplay.d, I get the following: C:\...\dlang\arsd-master>dmd -Lgdi32.lib -L user32.lib simpledisplay.d color.d OPTLINK

Re: Visual Studio Linker Problem

2016-10-18 Thread Jason C. Wells via Digitalmars-d-learn
On Tuesday, 18 October 2016 at 18:09:11 UTC, Johan Engelen wrote: So this was a VS installation issue? (Visual Studio set the LIB path wrong?) I'm not sure where LIB was set.

Re: Visual Studio Linker Problem

2016-10-18 Thread Jason C. Wells via Digitalmars-d-learn
C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat did in fact exist. My search for the file must have been errant. ldc2.exe hello.d also failed in cmd.exe. I took Mike's advice to run cmd.exe from one of the environments provided in the VS start menu. I tried to co

Visual Studio Linker Problem

2016-10-17 Thread Jason C. Wells via Digitalmars-d-learn
different arch-es and I happen to be a FreeBSD guy which uses LLVM by default. I figure that what I learn in LDC under windows will be portable for me. I received this error: $ ldc2 hello.d Using Visual C++: C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC LINK : fatal error LNK1104

Render SVG To Display And Update Periodically

2016-10-16 Thread Jason C. Wells via Digitalmars-d-learn
ssing whether or not these things are suitable for what I hope to do. Thanks in advance, Jason C. Wells

Re: How to correctly display accented characters at the Windows prompt?

2016-10-10 Thread John C via Digitalmars-d-learn
On Monday, 10 October 2016 at 14:14:08 UTC, Cleverson Casarin Uliana wrote: Hello, when I run a compiled Windows executable at the console, letters outside the ascii range such as ç and ã do not display propperly. Is there any d function to change the console code page on the fly? My Windows co

Re: Basic sounds' playing

2016-10-08 Thread John C via Digitalmars-d-learn
On Saturday, 8 October 2016 at 13:35:57 UTC, Cleverson Casarin Uliana wrote: Thank you Vadim and John, the PlaySound function is enough for now. I'm not yet developing an app, just experimenting with some exercises. The wasapi library seems interesting, does it also implement a playSound-like

Re: Basic sounds' playing

2016-10-08 Thread John C via Digitalmars-d-learn
On Saturday, 8 October 2016 at 01:00:20 UTC, Cleverson Casarin Uliana wrote: Hello all, starting to learn d, apreciating it so far. I'd like to play/stop wave sound files assynchronously on Windows. Can I get a module for that by installing a particular compiler, or is there any package for it

Re: Convert type tuple to array?

2016-10-05 Thread John C via Digitalmars-d-learn
On Wednesday, 5 October 2016 at 11:46:14 UTC, Adam D. Ruppe wrote: On Wednesday, 5 October 2016 at 11:43:12 UTC, John C wrote: Is there a way to convert something like AliasSeq!(int, int, int) to an int[] - the opposite of aliasSeqOf? If it is a legal array (matching types), just put

Convert type tuple to array?

2016-10-05 Thread John C via Digitalmars-d-learn
Is there a way to convert something like AliasSeq!(int, int, int) to an int[] - the opposite of aliasSeqOf?

Re: Member not accessible in delegate body

2016-09-23 Thread John C via Digitalmars-d-learn
On Friday, 23 September 2016 at 18:20:24 UTC, Martin Nowak wrote: Please file a bug report issues.dlang.org, shouldn't be difficult to fix. Done: https://issues.dlang.org/show_bug.cgi?id=16531

Member not accessible in delegate body

2016-09-23 Thread John C via Digitalmars-d-learn
If I try to call the protected method of a superclass from inside the body of a delegate, the compiler won't allow it. void layoutTransaction(Control c, void delegate() action) { // do stuff action(); // do more stuff } class Control { protected void onTextChanged() {} } class

Generating a tree structure

2014-08-21 Thread Ricky C via Digitalmars-d-learn
I'm trying to make a tree data structure in part of my first non-trivial D-based program. Turns out that DMD likes to re-use PODs - sounds good, but that trapped me, and I'm not sure how to clear myself out of the problem nicely. My simplified, but not oversimplified, example is http://dpast

Re: DWiki tables

2012-08-08 Thread Justin C Calvarese
On Wednesday, 8 August 2012 at 18:50:52 UTC, Jesse Phillips wrote: On Wednesday, 8 August 2012 at 17:50:42 UTC, Andrej Mitrovic wrote: I've asked this before about editing the front-page but I can't find the topic anymore. I think this page: http://prowiki.org/wiki4d/wiki.cgi?D__Tutorial/Starti

Invalid bounding interval [, ]

2012-01-25 Thread C
7;, prng)); Error (at runtime): object.Exception@c:\dmd2\windows\bin\..\..\src\phobos\std\random.d(971): std.random.uniform(): invalid bounding interval [ , �] 423C50 423AC7 404EA8 404EEC 404AE3 4A6109 Also I lost the URL for this forum, all I see is this nasty PHP News Reader interface. Thank you.

Re: Invalid bounding interval [, ]

2012-01-25 Thread C
> auto chunk = new ubyte[1024]; > foreach(ref x; chunk) x = uniform!"[]"(ubyte.min, ubyte.max); Thank you all for your replies. @ Timon, I have two questions: 1) How come you can omit parentheses for uniform's parameter, shouldn't it be uniform!("[]")(...) ? 2) Does auto chunk = new ubyte[1024];

Proper way to work with huge binary files

2012-01-24 Thread C
Hello all. After a quick recce on the main D site I couldn't find a how-to for large binary files. Suppose I'm using an old machine with limited memory, and I want to compute the MD5 hash of a 4 GB file. Do I need to buffer the input as in C++? And how should I check for exceptions? Ex

Re: Examples using Tango

2010-12-29 Thread Justin C Calvarese
going to be increasingly difficult to write examples that do the same thing using both libraries. The example writer would basically be writing the 2 different examples in many cases. Some library writers target both Phobos and Tango, and I suspect it can be very frustrating. > 3) I'd like

Re: Any usable parsers for D2 around?

2010-10-28 Thread Justin C Calvarese
== Quote from Bruno Medeiros (brunodomedeiros+s...@com.gmail)'s article > I so wished there was a ANTLR based parser for D, or at least an ANTLR > grammar. I remember seeing some talk in the D newsgroups over the years about the desire for an ANTLR file for D. After a quick search of Wiki4D, I fo

Re: Question about contracts on methods.

2009-11-30 Thread Peter C. Chapin
Don wrote in news:hf0obf$1th...@digitalmars.com: >> void next() >> in { >> int original_day_m = day_m; >> int original_month_m = month_m; >> int original_year_m = year_m; >> } >> out { >> assert( ... expression using original_day_m, etc ... ) >>

Re: Question about contracts on methods.

2009-11-28 Thread Peter C. Chapin
Lutger wrote in news:hescc2$16...@digitalmars.com: > You are not missing something, this is a known issue. It has been > discussed and I believe the intention was to do something about this, > but with all the high priorities I'm not sure when this will be > solved. Okay, thanks for the inform

Question about contracts on methods.

2009-11-28 Thread Peter C. Chapin
Hi! I'm rather new to D and I'm experimenting with its support for contracts. I'm using dmd v1.51 on Windows. Whenever I learn a new language I usually start by implementing a few "classic" components to get a feeling for how the language's features work in a pseudo-realistic setting. A class

Re: CRTP in D?

2009-08-20 Thread John C
div0 Wrote: > > > While we're on the subject, is it possible to mixin in a tuple? > Doesn't seem like you can... > > class C(M...) { > mixin M; > } > > Doesn't work. import std.typetuple; class C(M...) { mixin TypeTuple!(M); }

Re: Enum name convention consistency

2009-08-19 Thread John C
Sam Hu wrote: From std.range: enum StoppingPolicy { /// Stop when the shortest range is exhausted shortest, /// Stop when the longest range is exhausted longest, /// Require that all ranges are equal requireSameLength, } From std.thread:( phobos webpage) enum State; A f

Re: win32 capCreateCaptureWindow problem

2009-08-14 Thread John C
Sam Hu wrote: John C Wrote: Sam Hu Wrote: John C Wrote: Ivan Boritsky wrote: i work on a win32 application. i try to access my web camera. when i use this api funtion; capCreateCaptureWindow("cam", WS_VISIBLE + WS_CHILD, 10, 10,266, 252, hWnd, 0); That should be: WS_VISIBLE

Re: win32 capCreateCaptureWindow problem

2009-08-13 Thread John C
Sam Hu Wrote: > John C Wrote: > > > Ivan Boritsky wrote: > > > i work on a win32 application. i try to access my web camera. > > > when i use this api funtion; > > > capCreateCaptureWindow("cam", WS_VISIBLE + WS_CHILD, 10, 10,266, 252, &g

Re: win32 capCreateCaptureWindow problem

2009-08-12 Thread John C
Ivan Boritsky wrote: i work on a win32 application. i try to access my web camera. when i use this api funtion; capCreateCaptureWindow("cam", WS_VISIBLE + WS_CHILD, 10, 10,266, 252, hWnd, 0); That should be: WS_VISIBLE | WS_CHILD. i get this error: Error: undefined identifier capCreateCaptur

Re: D2 phobos std.date question

2009-07-15 Thread John C
Sam Hu Wrote: > Stewart Gordon Wrote: > > > > > Read the source of std.date and see for yourself. If it's getting it > > wrong, it suggests either your system is misconfigured or you're using > > it wrongly. But since you still haven't posted your code, I still can't > > comment further. >

Re: remove a file with tango

2009-07-14 Thread John C
John Cahn Wrote: > anyone know how to delete/remove a file with tango. thanks in advance. http://www.dsource.org/projects/tango/wiki/ChapterIoFileSystem

Re: Compiling Templates

2009-06-29 Thread Joel C. Salomon
Walter Bright wrote: > http://www.reddit.com/r/programming/comments/8wgak/compiling_templates/ Nice & informative. Now if there were only such a readable description of how exceptions work… —Joel Salomon

Re: Object.factory create instance failed?

2009-06-26 Thread John C
Sam Hu Wrote: > John C Wrote: > > > Object.factory requires a fully qualified class name, so if class Dog > > resides in module animals, call Object.factory("animals.Dog"). > > It works now.Great!Thanks so much! > > But...may I ask how do you know that

Re: Object.factory create instance failed?

2009-06-25 Thread John C
Sam Hu Wrote: > > In below code snippet: > > class Dog > { > public void bark(){} > } > int main(string[] args) > { > auto obj=Object.factory("Dog"); > Dog doggie=cast(Dog)obj; > doggie.bark; > > return 0; > } > > Compiled successfully but failed when run: > Object.Error:Access Violation. > >

Re: Using to! ?

2009-06-17 Thread John C
unknown Wrote: > Hi, > > Given the example below: > string str = "1 2 3 4 5 6"; > double[] numbers = to!(double[])(split(str)); > writefln(to!string(numbers)); > > I get [1, 2, 3, 4, 5, 6] which is okay. > > How do I output it with different separators? > > What I would like to get is [ 1 2 3

Re: Inside the switch statement

2009-06-15 Thread Joel C. Salomon
Kagamin wrote: > The Duff's device is said to be an optimization, but I get blunt device only > 0.7% slower. Read Duff’s post: “this loop was the bottleneck in a real-time animation playback program”, and all the Device is doing is unwinding the loop a few times. Optimization comes because — on

Porting 1.x libraries to 2.x

2009-06-10 Thread John C
What strategies do library authors have for maintaining two versions of a their code - one for D 1.0 and another for 2.0? When they make changes to one version, do they manually copy them into the other branch? Or is there a way of automating the process? Version blocks don't seem to help much.

Re: A couple of questions

2009-05-13 Thread John C
Sam Hu Wrote: > Thanks.The construct is clear now. > > Still leaves Q1,that is ,the *if* expression after the template definition,I > want to learn more about the usage,where can I find more information? It is in the spec: http://www.digitalmars.com/d/2.0/template.html#Constraint

Re: 3 variant questions

2009-05-12 Thread John C
Saaa Wrote: > > > > import std.stdarg; > > > > assert( _arguments[0] is typeid(int*) ); > > auto arg = va_arg!(int*)(_argptr); > > *arg = 10; > > > > Probably. > > > > -- Daniel > > Calling the following returns an Access Violation Error after > correctly writing the two lines. > > void main()

Re: D2 string conversion

2009-05-10 Thread John C
Sam Hu Wrote: > Hi Sivo & John, > > Thank you very much!!!The two versions all work. > > But I am a bit confused with the key word *in* in both versions. It's simple, really. Strings are immutable in D2. And "in" is equivalent to "immutable". By the way, best to use wstring (for UTF-16) or st

Re: D2 string conversion

2009-05-09 Thread John C
Sam Hu Wrote: > Hello, > > In D2 I tried to write a simple function which wrapps WIN32 API > MessageBoxW,with which I can handle wide characters like Chinese .Below is my > try: > > import std.string; > import std.conv; > import std.c.windows.windows; > > extern(Windows)int MessageBoxW(HWND,L

Re: Resource availability: fonts

2009-05-06 Thread John C
Tyro[a.c.edwards] Wrote: > When I do this, how do I ensure that the program is able to locate the > font after extraction without "installing" it? > I think AddFontResource from the SDK will do that. http://msdn.microsoft.com/en-us/library/dd183326(VS.85).aspx

Re: convert *void to void[]

2009-05-06 Thread John C
gabrielsylar Wrote: > can anybody please tell me how to properly convert from void* to void[] > as the code below? > > void[] get_bytes(int n) { return sqlite3_column_blob(stmt, n); } return sqlite3_column_blob(stmt, n)[0 .. n];

Re: line drawing package?

2009-05-03 Thread John C
BCS Wrote: > I find my self in need of a line drawing package. I need to pop a window > and draw lines and points. Text would be nice but I can live without it. > Most importantly, I need something that is dirt simple to get running. I > don't have time to dink around with libs (if I did have t

Re: convert and assign to the BSTR char

2009-04-18 Thread John C
new Wrote: > hi, > > how does one convert char[] to BSTR and back? i am looking to use a dll that > contains function such as > > BSTR tester = gettest(BSTR *in, BSTR in1); > > any help is appreciated. wchar* bstr = SysAllocString(std.utf.toUTF16z(s)); and char[] s = std.utf.toUTF8(bstr

Re: Wht std.complex is needed?

2009-04-06 Thread Joel C. Salomon
bearophile wrote: > A better question can be: "What's the advantage of having a built-in > imaginary type?" :-) > You can find an answer here, from page 11: > http://www.eecs.berkeley.edu/~wkahan/JAVAhurt.pdf > But maybe those ideas aren't much true anymore today. Why could you not make a struct

Re: Template function : use the array's one !

2009-02-18 Thread John C
TSalm Wrote: > Hello, > > I'm searching to have a generic comparator function. > > I done this : > > /* CODE */ > import tango.io.Stdout; > > /*** > * Not for arrays > ***/ > int compare(T)(T o1,T o2) > { >static if ( is( T bar == class ) || is( T

Structuring a library project—best practices ?

2009-02-11 Thread Joel C. Salomon
I’m starting work on my Geometric Algebra library , and I’d like some tips on structuring the source tree. Is there a “standard” place to put the library test/demonstration? Right now I’m starting with: trunk/ gald/ e2.d test.d ds

Learning by Doing: dimensioning units or geometric algebra?

2009-02-03 Thread Joel C. Salomon
Hello all, I’m a C programmer with some C++ experience (“C with Classes”+STL anyway; never did implement anything but the most trivial templates) and I’m looking to get stated with D. I figured a good way to do that would be to implement a template library, and it may as well be something I’ll

Re: Getting environment variables?

2008-11-24 Thread John C
novice2 Wrote: > i am afraid that windows API named *W works with UCS2 string. > but D wchar[] is UTF-16. Wrong - Windows has used UTF-16 as native since Windows 2000.