Re: How to call a C function from D that takes a FILE * as an argument?

2018-07-03 Thread Adam D. Ruppe via Digitalmars-d-learn
On Wednesday, 4 July 2018 at 02:54:47 UTC, Joe wrote: Now I fixed this by changing the import to core.stdc.stdio. I guess the problem is if you import std.stdio (which brings in the other one), there are two slightly incompatible stdout's and the D takes precedence. If you import both modules

Re: How to call a C function from D that takes a FILE * as an argument?

2018-07-03 Thread Joe via Digitalmars-d-learn
On Wednesday, 4 July 2018 at 02:16:00 UTC, Seb wrote: Hmm, calling e.g. fprintf with stdout should just work: --- void main() { import core.stdc.stdio; fprintf(stdout, "Hello %s", "world".ptr); } --- Could you maybe provide your whole code? This short test program shows the error: --

Re: How to call a C function from D that takes a FILE * as an argument?

2018-07-03 Thread Seb via Digitalmars-d-learn
On Wednesday, 4 July 2018 at 02:08:11 UTC, Joe wrote: On Wednesday, 4 July 2018 at 01:58:15 UTC, Seb wrote: So just add the declaration to your D file: --- extern(C) void myCfunction(FILE* stream); --- I do have a similar declaration in D. It appears the problem is that the C program I'm tr

Re: How to call a C function from D that takes a FILE * as an argument?

2018-07-03 Thread Joe via Digitalmars-d-learn
On Wednesday, 4 July 2018 at 01:58:15 UTC, Seb wrote: So just add the declaration to your D file: --- extern(C) void myCfunction(FILE* stream); --- I do have a similar declaration in D. It appears the problem is that the C program I'm trying to convert passes stdout as the argument and the

Re: How to call a C function from D that takes a FILE * as an argument?

2018-07-03 Thread Seb via Digitalmars-d-learn
On Wednesday, 4 July 2018 at 01:06:36 UTC, Joe wrote: The subject basically says it all. The C function uses the argument to call fprintf and also passes it to other functions where it's used to call fileno, fprintf or putc. Like you would with C's fprintf (https://dlang.org/phobos/core_stdc_

How to call a C function from D that takes a FILE * as an argument?

2018-07-03 Thread Joe via Digitalmars-d-learn
The subject basically says it all. The C function uses the argument to call fprintf and also passes it to other functions where it's used to call fileno, fprintf or putc.

Re: Help using lubeck on Windows

2018-07-03 Thread 9il via Digitalmars-d-learn
On Wednesday, 4 July 2018 at 00:23:36 UTC, 9il wrote: On Sunday, 25 February 2018 at 14:26:24 UTC, Arredondo wrote: On Friday, 23 February 2018 at 18:29:09 UTC, Ilya Yaroshenko wrote: [...] It is not working my friend. I've been at this for nearly two full days now. All the .lib/.a files I h

Re: Help using lubeck on Windows

2018-07-03 Thread 9il via Digitalmars-d-learn
On Sunday, 25 February 2018 at 14:26:24 UTC, Arredondo wrote: On Friday, 23 February 2018 at 18:29:09 UTC, Ilya Yaroshenko wrote: openblas.net contains precompiled openblas library for Windows. It may not be optimised well for exactly your CPU but it is fast enought to start. Put the library fi

Re: Issues with undefined symbols when using Vibe on Windows

2018-07-03 Thread kinke via Digitalmars-d-learn
On Tuesday, 3 July 2018 at 17:54:08 UTC, Seb wrote: BTW in case someone has a bit of time to look at the MinGW headers. They are built as part of the `build-mingw-libs` branch at the installer repo: https://github.com/dlang/installer/blob/build-mingw-libs/windows/build_mingw.bat This is autom

Re: Issues with undefined symbols when using Vibe on Windows

2018-07-03 Thread rikki cattermole via Digitalmars-d-learn
On 04/07/2018 6:24 AM, Chris M. wrote: Looks like there's a user32.def file in the src package that does not have these two functions defined. Not too sure how this vcvars64.bat file builds the 64-bit libraries from this, but I think I'll have to open a ticket with the mingw devs to have them b

Re: Issues with undefined symbols when using Vibe on Windows

2018-07-03 Thread Chris M. via Digitalmars-d-learn
On Tuesday, 3 July 2018 at 18:24:47 UTC, Chris M. wrote: On Tuesday, 3 July 2018 at 17:54:08 UTC, Seb wrote: [...] https://sourceforge.net/projects/mingw/files/MinGW/Base/w32api/w32api-5.0.2/ Looks like there's a user32.def file in the src package that does not have these two functions defin

Re: Issues with undefined symbols when using Vibe on Windows

2018-07-03 Thread Chris M. via Digitalmars-d-learn
On Tuesday, 3 July 2018 at 17:54:08 UTC, Seb wrote: On Tuesday, 3 July 2018 at 15:10:34 UTC, Chris M. wrote: On Tuesday, 3 July 2018 at 14:38:53 UTC, Mike Parker wrote: On Tuesday, 3 July 2018 at 13:32:21 UTC, Chris M. wrote: After hashing it out with some people on the Discord, I'm fairly

Re: Issues with undefined symbols when using Vibe on Windows

2018-07-03 Thread Seb via Digitalmars-d-learn
On Tuesday, 3 July 2018 at 15:10:34 UTC, Chris M. wrote: On Tuesday, 3 July 2018 at 14:38:53 UTC, Mike Parker wrote: On Tuesday, 3 July 2018 at 13:32:21 UTC, Chris M. wrote: After hashing it out with some people on the Discord, I'm fairly certain we narrowed it down to the 64-bit user32.lib

Re: how to create an array of scoped objects ?

2018-07-03 Thread Flaze07 via Digitalmars-d-learn
On Tuesday, 3 July 2018 at 15:06:28 UTC, Mike Parker wrote: .. That said, the GC in D runs when main exits anyway, so the destructor in your example will be called. That's why I warned earlier about it being nondeterministic. For example, if you have a Texture instance that depends on the cont

Re: Issues with undefined symbols when using Vibe on Windows

2018-07-03 Thread Chris M. via Digitalmars-d-learn
On Tuesday, 3 July 2018 at 14:38:53 UTC, Mike Parker wrote: On Tuesday, 3 July 2018 at 13:32:21 UTC, Chris M. wrote: After hashing it out with some people on the Discord, I'm fairly certain we narrowed it down to the 64-bit user32.lib from mingw missing these functions. https://issues.dlan

Re: how to create an array of scoped objects ?

2018-07-03 Thread Mike Parker via Digitalmars-d-learn
On Tuesday, 3 July 2018 at 14:42:58 UTC, Flaze07 wrote: On Tuesday, 3 July 2018 at 14:32:01 UTC, Mike Parker wrote: Resources allocated for the process will be released on exit. I see...but it is dependant on the OS right ? because I have seen other stuff relating to malloc as well, there ar

Re: what's the correct way to handle unicode? - trying to print out graphemes here.

2018-07-03 Thread Steven Schveighoffer via Digitalmars-d-learn
On 7/3/18 10:37 AM, ag0aep6g wrote: On Tuesday, 3 July 2018 at 13:32:52 UTC, aliak wrote: foreach (c; "👩‍👩‍👦‍👦🏳️‍🌈") {   writeln(c); } So basically the above just doesn't work. Prints gibberish. Because you're printing one UTF-8 code unit (`char`) per line. So I figured, std.uni.byGrapheme w

Re: how to create an array of scoped objects ?

2018-07-03 Thread Flaze07 via Digitalmars-d-learn
On Tuesday, 3 July 2018 at 14:32:01 UTC, Mike Parker wrote: Resources allocated for the process will be released on exit. I see...but it is dependant on the OS right ? because I have seen other stuff relating to malloc as well, there are some out there that said that there is no need to free

Re: what's the correct way to handle unicode? - trying to print out graphemes here.

2018-07-03 Thread Adam D. Ruppe via Digitalmars-d-learn
On Tuesday, 3 July 2018 at 13:32:52 UTC, aliak wrote: So basically the above just doesn't work. Prints gibberish. What system are you on? Successfully printing this stuff depends on a lot of display details too, like writeln goes to a terminal/console and they are rarely configured to support

Re: Issues with undefined symbols when using Vibe on Windows

2018-07-03 Thread Mike Parker via Digitalmars-d-learn
On Tuesday, 3 July 2018 at 13:32:21 UTC, Chris M. wrote: After hashing it out with some people on the Discord, I'm fairly certain we narrowed it down to the 64-bit user32.lib from mingw missing these functions. https://issues.dlang.org/show_bug.cgi?id=19051 So are the mingw libs only ship

Re: what's the correct way to handle unicode? - trying to print out graphemes here.

2018-07-03 Thread ag0aep6g via Digitalmars-d-learn
On Tuesday, 3 July 2018 at 13:36:56 UTC, aliak wrote: Hehe I guess the forum really is using D :p The two graphemes I'm talking about (which seem to not be rendered correctly above) are: family emoji: https://emojipedia.org/family-woman-woman-boy-boy/ rainbow flag: https://emojipedia.org/rain

Re: what's the correct way to handle unicode? - trying to print out graphemes here.

2018-07-03 Thread ag0aep6g via Digitalmars-d-learn
On Tuesday, 3 July 2018 at 13:32:52 UTC, aliak wrote: foreach (c; "👩‍👩‍👦‍👦🏳️‍🌈") { writeln(c); } So basically the above just doesn't work. Prints gibberish. Because you're printing one UTF-8 code unit (`char`) per line. So I figured, std.uni.byGrapheme would help, since that's what they ar

Re: what's the correct way to handle unicode? - trying to print out graphemes here.

2018-07-03 Thread Steven Schveighoffer via Digitalmars-d-learn
On 7/3/18 9:32 AM, aliak wrote: Hi, trying to figure out how to loop through a string of characters and then spit them back out. Eg: foreach (c; "👩‍👩‍👦‍👦🏳️‍🌈") {   writeln(c); } So basically the above just doesn't work. Prints gibberish. So I figured, std.uni.byGrapheme would help, since th

Re: how to create an array of scoped objects ?

2018-07-03 Thread Mike Parker via Digitalmars-d-learn
On Tuesday, 3 July 2018 at 10:56:26 UTC, Flaze07 wrote: hmm, I assume you know about DSFML, so... i.e void main( string args[] ) { auto win = new RenderWindow( VideoMode( 400, 400 ), "resource leak ?" ); win.close(); } //in this context, is there any memory leak ? because I saw from

Re: what's the correct way to handle unicode? - trying to print out graphemes here.

2018-07-03 Thread aliak via Digitalmars-d-learn
On Tuesday, 3 July 2018 at 13:32:52 UTC, aliak wrote: Hi, trying to figure out how to loop through a string of characters and then spit them back out. Eg: foreach (c; "👩‍👩‍👦‍👦🏳️‍🌈") { writeln(c); } So basically the above just doesn't work. Prints gibberish. So I figured, std.uni.byGrapheme

Re: Issues with undefined symbols when using Vibe on Windows

2018-07-03 Thread Chris M. via Digitalmars-d-learn
On Tuesday, 3 July 2018 at 05:36:12 UTC, Seb wrote: On Monday, 2 July 2018 at 23:00:08 UTC, Chris M. wrote: On Monday, 2 July 2018 at 21:20:26 UTC, Seb wrote: On Monday, 2 July 2018 at 19:24:38 UTC, Chris M. wrote: On Monday, 2 July 2018 at 18:48:16 UTC, Jonathan M Davis wrote: [...] Downlo

what's the correct way to handle unicode? - trying to print out graphemes here.

2018-07-03 Thread aliak via Digitalmars-d-learn
Hi, trying to figure out how to loop through a string of characters and then spit them back out. Eg: foreach (c; "👩‍👩‍👦‍👦🏳️‍🌈") { writeln(c); } So basically the above just doesn't work. Prints gibberish. So I figured, std.uni.byGrapheme would help, since that's what they are, but I can't g

Re: how to create an array of scoped objects ?

2018-07-03 Thread Flaze07 via Digitalmars-d-learn
On Tuesday, 3 July 2018 at 10:00:00 UTC, Mike Parker wrote: The only way you're going to be leaking resources is if the app is long running and the resource objects are never collected. I'd be more concerned about the nondeterministic nature of the destructor calls, particularly what happens

Re: how to create an array of scoped objects ?

2018-07-03 Thread Mike Parker via Digitalmars-d-learn
On Tuesday, 3 July 2018 at 07:29:12 UTC, Flaze07 wrote: class RenderWindow { private sfRenderWindow* _window; public { this() { _window = sfRenderWindow_create(/*parameters*/); } //couple of other functions ~this() { sfRenderW

Re: how to create an array of scoped objects ?

2018-07-03 Thread Flaze07 via Digitalmars-d-learn
On Tuesday, 3 July 2018 at 07:03:43 UTC, vit wrote: On Tuesday, 3 July 2018 at 02:13:21 UTC, Flaze07 wrote: e.g A is a class that emits output during destruction { auto a = scoped!A(); } how do I contain it in a container, in the Array struct ? { auto a = scoped!A(); Array!( typeof

Re: how to create an array of scoped objects ?

2018-07-03 Thread vit via Digitalmars-d-learn
On Tuesday, 3 July 2018 at 02:13:21 UTC, Flaze07 wrote: e.g A is a class that emits output during destruction { auto a = scoped!A(); } how do I contain it in a container, in the Array struct ? { auto a = scoped!A(); Array!( typeof( a ) ) arr; foreach( i ; 0..3 ) { arr.in