Re: vibe.db.postgresql: Example not working in Windows

2023-04-14 Thread Salih Dincer via Digitalmars-d-learn
On Friday, 14 April 2023 at 17:06:36 UTC, Vino wrote: I was just trying the new package vibe.db.postgresql and the example provided is not working, can some one provide me an working example. Step performed ``` dub init dub add vibe-d-postgresql copy the example program to source/app.d dub

Re: Unresolvable dependencies to package

2023-04-14 Thread Hipreme via Digitalmars-d-learn
On Friday, 14 April 2023 at 20:30:56 UTC, el machine code wrote: so my question why am i'm getting this error and how do i fix this? You need to make those depends on the same version somehow. From what I've looked. Luna maintains its own fork of bindbc-imgui. You're probably taking from

Re: How to setup D with SFML? (using bindbc-sfml)

2023-04-14 Thread Salih Dincer via Digitalmars-d-learn
On Friday, 14 April 2023 at 12:26:25 UTC, Ki Rill wrote: Yay! That worked! Now I have a working example. Though it's strange that it does not work with shared libs. Good luck, I'm really happy for you... Ki Rill, wait a minute! Actually, i've been very happy for the D community. Because I

Unresolvable dependencies to package

2023-04-14 Thread el machine code via Digitalmars-d-learn
I just added dub add inochi-creator then dub run but got the error: ``` Unresolvable dependencies to package bindbc-sdl: bindbc-imgui 0.7.0 depends on bindbc-sdl ~>0.21.4 inochi-creator 0.7.4 depends on bindbc-sdl ~>1.1.2 ``` the dub.json looks like this: ``` { "authors": [

Re: Unresolvable dependencies to package

2023-04-14 Thread Mike Parker via Digitalmars-d-learn
On Friday, 14 April 2023 at 20:30:56 UTC, el machine code wrote: so my question why am i'm getting this error and how do i fix this? The two listed packages depend on bindbc-sdl, and they do so in a way that is incompatible with each other. On your end, you can edit `dub.selections.json` in

Re: Unresolvable dependencies to package

2023-04-14 Thread el machine code via Digitalmars-d-learn
so my question why am i'm getting this error and how do i fix this?

Re: Unresolvable dependencies to package

2023-04-14 Thread Salih Dincer via Digitalmars-d-learn
On Friday, 14 April 2023 at 20:30:56 UTC, el machine code wrote: so my question why am i'm getting this error and how do i fix this? As far as I know imGUI works with SFML. First, please appear a Japanese flag on your screen:

Re: Unresolvable dependencies to package

2023-04-14 Thread Mike Parker via Digitalmars-d-learn
On Saturday, 15 April 2023 at 00:42:17 UTC, Mike Parker wrote: I also suggest you visit the issues page for bindbc-imgui and file an issue there: I meant to delete this line. I've filed the issue: https://github.com/BindBC/bindbc-imgui/issues/1

Re: Returning a reference to be manipulated

2023-04-14 Thread Dennis via Digitalmars-d-learn
On Friday, 14 April 2023 at 10:31:58 UTC, kdevel wrote: But in fact it is returned unless it is `return ref`. When using `return ref`, `return scope`, `scope` etc., you should be using the latest compiler and annotate functions you want checked with `@safe`. In previous versions, the

Re: Memory leak issue between extern (c) and D function

2023-04-14 Thread Guillaume Piolat via Digitalmars-d-learn
On Friday, 14 April 2023 at 11:15:59 UTC, Guillaume Piolat wrote: OP could add another extern(C) D function to free the allocated object. Or another extern(C) D function to call GC.addRoot Or simpler, add that object to a list of object in D DLL __gshared list, then clear the list (or set

Re: What do you think about using Chat GPT to create functions in D?

2023-04-14 Thread Ferhat Kurtulmuş via Digitalmars-d-learn
On Monday, 3 April 2023 at 23:38:52 UTC, Marcone wrote: What do you think about using Chat GPT to create functions in D? I asked Chat-GPT to create a function in D that was similar to the rsplit() function in Python. It returned this code to me: import std.algorithm; import std.array; import

Re: Returning a reference to be manipulated

2023-04-14 Thread Bastiaan Veelo via Digitalmars-d-learn
On Friday, 14 April 2023 at 00:50:31 UTC, kdevel wrote: ``` ref int foo (ref int i) { return i; } ref int bar () { int i; return foo (i); } void main () { import std.stdio; auto i = bar; i.writeln; } ``` Up to dmd v2.100.2 I am warned/get an error during compilation: ``` $

Re: Memory leak issue between extern (c) and D function

2023-04-14 Thread Guillaume Piolat via Digitalmars-d-learn
On Friday, 14 April 2023 at 04:43:39 UTC, Paul Backus wrote: If you want the GC to clean up your memory, use `new` to allocate it instead of `malloc`. Like this: ```d mystruct* getmystruct() { return new mystruct; } ``` That won't work because the C++ programm calling the D dynlib

Re: Returning a reference to be manipulated

2023-04-14 Thread kdevel via Digitalmars-d-learn
On Friday, 14 April 2023 at 09:42:14 UTC, Bastiaan Veelo wrote: [...] Up to dmd v2.100.2 I am warned/get an error during compilation: ``` $ dmd returnref2.d returnref2.d(3): Deprecation: returning `i` escapes a reference to parameter `i` returnref2.d(1):perhaps annotate the parameter

Re: How to setup D with SFML? (using bindbc-sfml)

2023-04-14 Thread Ki Rill via Digitalmars-d-learn
On Friday, 14 April 2023 at 02:33:18 UTC, Salih Dincer wrote: On Friday, 14 April 2023 at 00:28:53 UTC, Ki Rill wrote: ``` LINK : fatal error LNK1104: cannot open file 'libucrt.lib' Error: linker exited with status 1104 ``` Why does it require this library and where can I find it? Since this

Re: How to use @safe when a C library integration needed

2023-04-14 Thread Paul Backus via Digitalmars-d-learn
On Friday, 14 April 2023 at 14:10:41 UTC, Leonardo wrote: Thanks. But this works only to one function per time. Is there any way to do this to an imported library at all? something like `@trusted import library` No, there isn't. C is an unsafe language, so if you want to call C from `@safe`

Re: How to use @safe when a C library integration needed

2023-04-14 Thread Leonardo via Digitalmars-d-learn
On Monday, 23 January 2023 at 16:46:48 UTC, Dom DiSc wrote: On Monday, 23 January 2023 at 16:36:21 UTC, Leonardo wrote: Hello. How to use @safe when a C library integration needed? Everything need a system function... ```d @safe fn() { // lot of safe stuff () @trusted { // in

vibe.db.postgresql: Example not working in Windows

2023-04-14 Thread Vino via Digitalmars-d-learn
Hi All, I was just trying the new package vibe.db.postgresql and the example provided is not working, can some one provide me an working example. Step performed ``` dub init dub add vibe-d-postgresql copy the example program to source/app.d dub run ``` Error ``` source\app.d(3,8): Error:

Re: Memory leak issue between extern (c) and D function

2023-04-14 Thread backtrack via Digitalmars-d-learn
On Friday, 14 April 2023 at 11:15:59 UTC, Guillaume Piolat wrote: On Friday, 14 April 2023 at 04:43:39 UTC, Paul Backus wrote: If you want the GC to clean up your memory, use `new` to allocate it instead of `malloc`. Like this: ```d mystruct* getmystruct() { return new mystruct; } ```