Re: New developments on topic of memset, memcpy and similar

2021-11-27 Thread Igor via Digitalmars-d-learn
On Saturday, 27 November 2021 at 11:48:02 UTC, Imperatorn wrote: On Saturday, 27 November 2021 at 11:15:45 UTC, Igor wrote: Two years ago there was a [Google Summer of Code project](https://forum.dlang.org/thread/izaufklyvmktnwsrm...@forum.dlang.org) to implement these primitives in pure D for

New developments on topic of memset, memcpy and similar

2021-11-27 Thread Igor via Digitalmars-d-learn
Two years ago there was a [Google Summer of Code project](https://forum.dlang.org/thread/izaufklyvmktnwsrm...@forum.dlang.org) to implement these primitives in pure D for various reason. It was concluded the project isn't viable and was abandoned, but there were some interesting learnings. I now

Re: Small or big dub packages

2018-11-02 Thread Igor via Digitalmars-d-learn
On Thursday, 1 November 2018 at 14:07:37 UTC, Guillaume Piolat wrote: On Monday, 29 October 2018 at 11:31:55 UTC, Igor wrote: The way I see it the advantage of smaller packages is that users can pick and choose and and only have the code they really need in their project, but the con could

Small or big dub packages

2018-10-29 Thread Igor via Digitalmars-d-learn
Can someone tell me what are pros and cons of having multiple extra small dub packages that depend on each other versus one dub package that has a bunch of functionality? Good example for this is dlib (https://github.com/gecko0307/dlib). It has many functionalities that could be split into

Re: Load D shared library on windows x64

2018-08-18 Thread Igor via Digitalmars-d-learn
On Saturday, 18 August 2018 at 00:31:49 UTC, Tofu Ninja wrote: On Friday, 17 August 2018 at 20:27:05 UTC, Tofu Ninja wrote: Its this part that fails... always returns null HMODULE h = cast(HMODULE) Runtime.loadLibrary(dllName); if (h is null) { writeln("error loading"); return;

Re: Any book recommendation for writing a compiler?

2017-11-02 Thread Igor via Digitalmars-d-learn
On Thursday, 2 November 2017 at 03:55:27 UTC, Michael V. Franklin wrote: On Wednesday, 1 November 2017 at 20:53:44 UTC, Dr. Assembly wrote: Hey guys, if I were to get into dmd's source code to play a little bit (just for fun, no commercial use at all), which books/resources do you recommend to

Re: Dynamically import() files

2017-10-23 Thread Igor via Digitalmars-d-learn
On Monday, 23 October 2017 at 12:15:17 UTC, Andre Pany wrote: Hi, I have a folder "i18n" which contains message bundle files. For now it contains only the message bundle file written by the developer: "messagebundle.properties". [...] Can't you just create all the files that you expect to

Re: is(this : myClass)

2017-10-21 Thread Igor via Digitalmars-d-learn
On Friday, 20 October 2017 at 23:24:17 UTC, Patrick wrote: On Friday, 20 October 2017 at 23:01:25 UTC, Steven Schveighoffer wrote: On 10/20/17 6:23 PM, Patrick wrote: On Friday, 20 October 2017 at 22:15:36 UTC, Steven Schveighoffer wrote: On 10/20/17 5:55 PM, Patrick wrote: Due to the very

Re: How do I convert a LPVOID (void*) to string?

2017-10-19 Thread Igor via Digitalmars-d-learn
On Monday, 16 October 2017 at 22:54:32 UTC, Adam D. Ruppe wrote: On Monday, 16 October 2017 at 21:48:35 UTC, Nieto wrote: How do I convert/create a D string from LPVOID (void*)? There is no one answer to this, but for the specific function are are looking at, the ALLOCATE_BUFFER argument

Re: the best language I have ever met(?)

2017-10-13 Thread Igor via Digitalmars-d-learn
On Friday, 25 November 2016 at 19:16:43 UTC, ketmar wrote: On Friday, 25 November 2016 at 14:27:39 UTC, Igor Shirkalin wrote: On Wednesday, 23 November 2016 at 18:58:55 UTC, ketmar wrote: We can define static array without counting the elements as following: enum array_ = [1u,2,3,4];

Re: Two way struct wrapper

2017-10-13 Thread Igor via Digitalmars-d-learn
On Wednesday, 11 October 2017 at 12:35:51 UTC, drug wrote: Using `alias this` it's easy to make wrapper for structure that calls wrapped structure methods like its own. This is one way - from wrapper to wrapped transformation. Is it possible to create the opposite way from wrapped to wrapper?

Re: Alias on an array element

2017-10-13 Thread Igor via Digitalmars-d-learn
On Friday, 13 October 2017 at 02:04:03 UTC, Meta wrote: On Friday, 13 October 2017 at 01:12:38 UTC, solidstate1991 wrote: On Friday, 13 October 2017 at 01:09:56 UTC, solidstate1991 wrote: I'm making a struct for easy color handling Here's a code sample: ublic struct Color{ union{

Re: @nogc formattedWrite

2017-10-09 Thread Igor via Digitalmars-d-learn
On Saturday, 7 October 2017 at 18:27:36 UTC, jmh530 wrote: On Saturday, 7 October 2017 at 18:14:00 UTC, Nordlöw wrote: It would be nice to be able to formatted output in -betterC... Agreed. If you know the size of the buffer, you can use sformat, which might be @nogc, but I don't know if

Re: Region-based memory management and GC?

2017-09-30 Thread Igor via Digitalmars-d-learn
On Friday, 29 September 2017 at 22:13:01 UTC, Jon Degenhardt wrote: Have there been any investigations into using region-based memory management (aka memory arenas) in D, possibly in conjunction with GC allocated memory? This would be a very speculative idea, but it'd be interesting to know if

Re: Allocating byte aligned array

2017-09-29 Thread Igor via Digitalmars-d-learn
On Wednesday, 27 September 2017 at 21:48:35 UTC, timvol wrote: On Wednesday, 27 September 2017 at 21:44:48 UTC, Ali Çehreli wrote: On 09/27/2017 02:39 PM, timvol wrote: [...] void main() { auto mem = new ubyte[1024+15]; auto ptr = cast(ubyte*)(cast(ulong)(mem.ptr + 15) & ~0x0FUL);

Re: Temporarily adding -vgc to a DUB build

2017-09-17 Thread Igor via Digitalmars-d-learn
On Sunday, 17 September 2017 at 01:50:08 UTC, Nicholas Wilson wrote: On Saturday, 16 September 2017 at 21:45:34 UTC, Nordlöw wrote: How do I temporarily enable -vgc when building my app with DUB? I've tried DFLAGS=-vgc /usr/bin/dub build --build=unittest but it doesn't seem to have any

Re: failed loading freetype 2.6 via derelict-ft

2017-09-13 Thread Igor via Digitalmars-d-learn
On Wednesday, 13 September 2017 at 19:01:52 UTC, Spacen wrote: Hello, I am trying to resurect an old project, but can't get the freetype library loaded. I can't figgure out what to do it's been a while. I have just built the freetype 2.6 library with visual studio 2015. Any tips would be

Re: DerelictGL3 slow compilation speed with contexts

2017-09-13 Thread Igor via Digitalmars-d-learn
On Wednesday, 13 September 2017 at 13:25:01 UTC, Mike Parker wrote: On Wednesday, 13 September 2017 at 10:28:26 UTC, Igor wrote: Well since minimal example is a window app that opens a window, sets everything up and calls opengl stuff I will just push it to my github project this evening and

Re: DerelictGL3 slow compilation speed with contexts

2017-09-13 Thread Igor via Digitalmars-d-learn
On Wednesday, 13 September 2017 at 01:30:10 UTC, Mike Parker wrote: On Tuesday, 12 September 2017 at 21:55:23 UTC, Igor wrote: Hi All, I switched from using free functions in DerelictGL3 to DerelictGL3_Contexts and compilation speed in optimized build using DMD went from 2 seconds to 7

DerelictGL3 slow compilation speed with contexts

2017-09-12 Thread Igor via Digitalmars-d-learn
Hi All, I switched from using free functions in DerelictGL3 to DerelictGL3_Contexts and compilation speed in optimized build using DMD went from 2 seconds to 7 minutes and using LDC from 2 seconds to 10 seconds. Is this a known problem? Are there any workarounds?

Re: SIMD under LDC

2017-09-11 Thread Igor via Digitalmars-d-learn
On Monday, 11 September 2017 at 11:55:45 UTC, Igor wrote: In the meantime can anyone tell me how to add an attribute to a function only if something is defined, since this doesn't work: version(USE_SIMD_WITH_LDC) { import ldc.attributes; @target("ssse3") } void funcThatUsesSIMD() { ...

Re: SIMD under LDC

2017-09-11 Thread Igor via Digitalmars-d-learn
On Thursday, 7 September 2017 at 16:45:40 UTC, Igor wrote: On Thursday, 7 September 2017 at 15:24:13 UTC, Johan Engelen wrote: On Wednesday, 6 September 2017 at 20:43:01 UTC, Igor wrote: I opened a feature request on github. I also tried using the gccbuiltins but I got this error: LLVM

VisualD setup problems

2017-09-11 Thread Igor via Digitalmars-d-learn
I seem to have corrupted something within my installation and I can't find how to fix it. Earlier I was able to setup a breakpoint within some phobos module that I used and step through phobos code but that doesn't work any more. Does anyone know how I can make that work again?

Re: SIMD under LDC

2017-09-07 Thread Igor via Digitalmars-d-learn
On Thursday, 7 September 2017 at 15:24:13 UTC, Johan Engelen wrote: On Wednesday, 6 September 2017 at 20:43:01 UTC, Igor wrote: I opened a feature request on github. I also tried using the gccbuiltins but I got this error: LLVM ERROR: Cannot select: 0x2199c96fd70: v16i8 = X86ISD::PSHUFB

Re: SIMD under LDC

2017-09-06 Thread Igor via Digitalmars-d-learn
On Wednesday, 6 September 2017 at 09:01:18 UTC, Igor wrote: On Tuesday, 5 September 2017 at 18:50:34 UTC, Johan Engelen wrote: On Monday, 4 September 2017 at 20:39:11 UTC, Igor wrote: I found that I can't use __simd function from core.simd under LDC and that it has ldc.simd but I couldn't find

Re: SIMD under LDC

2017-09-06 Thread Igor via Digitalmars-d-learn
On Tuesday, 5 September 2017 at 18:50:34 UTC, Johan Engelen wrote: On Monday, 4 September 2017 at 20:39:11 UTC, Igor wrote: I found that I can't use __simd function from core.simd under LDC and that it has ldc.simd but I couldn't find how to implement equivalent to this with it: ubyte16*

Re: SIMD under LDC

2017-09-05 Thread Igor via Digitalmars-d-learn
On Tuesday, 5 September 2017 at 01:11:29 UTC, 12345swordy wrote: On Monday, 4 September 2017 at 23:06:27 UTC, Nicholas Wilson wrote: Don't underestimate ldc's optimiser ;) I seen cases where the compiler fail to optimized for smid. I tried it and LDC optimized build did generate SIMD

SIMD under LDC

2017-09-04 Thread Igor via Digitalmars-d-learn
I found that I can't use __simd function from core.simd under LDC and that it has ldc.simd but I couldn't find how to implement equivalent to this with it: ubyte16* masks = ...; foreach (ref c; pixels) { c = __simd(XMM.PSHUFB, c, *masks); } I see it has shufflevector function but it

Re: Making a repo of downloaded dub package

2017-09-04 Thread Igor via Digitalmars-d-learn
On Monday, 4 September 2017 at 14:35:47 UTC, Dukc wrote: Bump Search for word "local" here: https://code.dlang.org/docs/commandline. Maybe some of those can help you. If not you could make a pull request for dub that would support such a thing :)

Re: Problems with std.experimental.allocator

2017-09-03 Thread Igor via Digitalmars-d-learn
On Saturday, 2 September 2017 at 11:23:00 UTC, Igor wrote: I realize these are not yet stable but I would like to know if I am doing something wrong or is it a lib bug. My first attempt was to do this: theAllocator = allocatorObject(Region!MmapAllocator(1024*MB)); If I got it right

Problems with std.experimental.allocator

2017-09-02 Thread Igor via Digitalmars-d-learn
I realize these are not yet stable but I would like to know if I am doing something wrong or is it a lib bug. My first attempt was to do this: theAllocator = allocatorObject(Region!MmapAllocator(1024*MB)); If I got it right this doesn't work because it actually does this: 1. Create

Re: (SIMD) Optimized multi-byte chunk scanning

2017-08-25 Thread Igor via Digitalmars-d-learn
On Wednesday, 23 August 2017 at 22:07:30 UTC, Nordlöw wrote: I recall seeing some C/C++/D code that optimizes the comment- and whitespace-skipping parts (tokens) of lexers by operating on 2, 4 or 8-byte chunks instead of single-byte chunks. This in the case when token-terminators are expressed

Re: DerelictGL3 reload crashes in 32 builds

2017-08-23 Thread Igor via Digitalmars-d-learn
On Wednesday, 23 August 2017 at 12:59:38 UTC, Mike Parker wrote: On Tuesday, 22 August 2017 at 12:03:18 UTC, Igor wrote: [...] I'm not sure what you're referring to. There are a few static if(Derelict_OS_Android) blocks in there as well. [...] Ok Mike. Thanks for the info. If I learn

Re: DerelictGL3 reload crashes in 32 builds

2017-08-22 Thread Igor via Digitalmars-d-learn
On Tuesday, 22 August 2017 at 12:03:18 UTC, Igor wrote: On Monday, 21 August 2017 at 12:38:28 UTC, Mike Parker wrote: Have you tried to compile outside of VisualD? Hmmm... I though I tried running with just typing dub which should use m32 by default as far as I know and got the error. I

Re: DerelictGL3 reload crashes in 32 builds

2017-08-22 Thread Igor via Digitalmars-d-learn
On Monday, 21 August 2017 at 12:38:28 UTC, Mike Parker wrote: On Monday, 21 August 2017 at 02:40:59 UTC, Mike Parker wrote: On Sunday, 20 August 2017 at 19:29:55 UTC, Igor wrote: In 64 bit builds it works with both LDC and DMD but in 32 bit LDC version crashes and DMD release version crashes.

DerelictGL3 reload crashes in 32 builds

2017-08-20 Thread Igor via Digitalmars-d-learn
In 64 bit builds it works with both LDC and DMD but in 32 bit LDC version crashes and DMD release version crashes. Using LDC debug build I managed to find that it crashes after executing ret instruction from bindGLFunc in glloader. If someone wants to try it you can do it with this project:

Re: Unresolved external symbol InterlockedIncrement

2017-08-13 Thread Igor via Digitalmars-d-learn
On Sunday, 13 August 2017 at 16:29:14 UTC, Igor wrote: I am building a 64 bit windows app with latest DMD and I keep getting this linker error: error LNK2019: unresolved external symbol InterlockedIncrement referenced in function ThreadProc This function should be a part of kernel32.lib

Unresolved external symbol InterlockedIncrement

2017-08-13 Thread Igor via Digitalmars-d-learn
I am building a 64 bit windows app with latest DMD and I keep getting this linker error: error LNK2019: unresolved external symbol InterlockedIncrement referenced in function ThreadProc This function should be a part of kernel32.lib which I verified is found by using /VERBOSE:LIB linker

Re: Read/Write memory barriers in D?

2017-08-13 Thread Igor via Digitalmars-d-learn
On Sunday, 13 August 2017 at 11:58:56 UTC, Daniel Kozak wrote: or maybe use core.atomic.atomicLoad and store with right https://dlang.org/phobos/core_atomic.html#.MemoryOrder On Sun, Aug 13, 2017 at 1:51 PM, Daniel Kozak wrote: maybe something like

Read/Write memory barriers in D?

2017-08-13 Thread Igor via Digitalmars-d-learn
I am converting a C code that uses this macro: #define CompletePastWritesBeforeFutureWrites _WriteBarrier(); _mm_sfence() As far as I see core.atomic:atomicFence() is the equivalent of _mm_sfence() but I can't find what would be the equivalent of _WriteBarrier(). As far as I understand it

Profiling Windows App and DLL

2017-07-17 Thread Igor via Digitalmars-d-learn
Is there a known limitation in profiling these or am I doing something wrong? When I try to run my application from VisualD (x64 build) with -profile switch I just get Access Violation reported on WinMain function (actual declaration, it doesn't enter its body). If I build it with dub build

Re: Simple c header => Dlang constants using mixins in compile time

2017-06-17 Thread Igor via Digitalmars-d-learn
On Saturday, 17 June 2017 at 10:56:52 UTC, Igor Shirkalin wrote: Hello! I have a simple C header file that looks like: #define Name1 101 #define Name2 122 #define NameN 157 It comes from resource compiler and I need all these constants to be available in my Dlang program in compile time.

Re: Why is DUB not passing dll.def file to linker

2017-05-21 Thread Igor via Digitalmars-d-learn
On Sunday, 21 May 2017 at 11:47:15 UTC, Mike Parker wrote: So what I would try in your situation is to add three new configurations to the exeProject's dub.json. Use the "platforms" directive to limit one to "windows-x86", another to "windows-x86_64", and leave the other one empty. List the

Re: Why is DUB not passing dll.def file to linker

2017-05-21 Thread Igor via Digitalmars-d-learn
On Sunday, 21 May 2017 at 10:15:40 UTC, Mike Parker wrote: Then you can add the following to exeProject/dub.json: "dependencies": { "dllProjectName": {"path" : "../dllProject" } } I would expect the import lib to be linked automatically. This should ensure the dll is compiled with the

Re: Why is DUB not passing dll.def file to linker

2017-05-21 Thread Igor via Digitalmars-d-learn
On Saturday, 20 May 2017 at 21:36:42 UTC, Mike Parker wrote: On Saturday, 20 May 2017 at 20:26:29 UTC, Igor wrote: So my question is if the fix is so simple what are the reasons it isn't implemented? Am I missing something? I don't know, but you could always submit a PR or an enhancement

Re: Why is DUB not passing dll.def file to linker

2017-05-20 Thread Igor via Digitalmars-d-learn
On Saturday, 20 May 2017 at 20:04:27 UTC, Mike Parker wrote: On Saturday, 20 May 2017 at 19:53:16 UTC, Igor wrote: There is no mention of dll.def file. Add a "sourceFiles" directive: "sourceFiles-windows" : ["dll.def"] See the comments at the following:

Why is DUB not passing dll.def file to linker

2017-05-20 Thread Igor via Digitalmars-d-learn
I am using DUB 1.3.0. My folder structure is: project dub.json source windll.d handmade.d dll.def dub.json looks like this: { "name": "handmade", "targetType": "dynamicLibrary", "targetPath": "build", "configurations": [ {

Re: How to check a struct exists at a particular memory address?

2017-05-18 Thread Igor via Digitalmars-d-learn
On Thursday, 18 May 2017 at 20:20:47 UTC, Gary Willoughby wrote: This might be a really silly question but: I've allocated some memory like this (Foo is a struct): this._data = cast(Foo*) calloc(n, Foo.sizeof); How can I then later check that there is a valid Foo at `this._data` or

Re: How to setup DLL and EXE projects in one VS solution

2017-05-18 Thread Igor via Digitalmars-d-learn
On Thursday, 18 May 2017 at 18:00:02 UTC, Rainer Schuetze wrote: That's what I meant with "other cross module dependencies". In this case it might work if you export _D10handmade_h10game_input6__initZ from your DLL with the help of a def-file, but that's not something that scales well.

Re: How to setup DLL and EXE projects in one VS solution

2017-05-18 Thread Igor via Digitalmars-d-learn
On Thursday, 18 May 2017 at 07:10:54 UTC, Rainer Schuetze wrote: You have to add an import path to the folder with dllproj inside to the project configuration of the exeproject. If you want to limit the imported code to the declarations, you can enable "generate interface headers" and add

Re: How to setup DLL and EXE projects in one VS solution

2017-05-17 Thread Igor via Digitalmars-d-learn
On Wednesday, 17 May 2017 at 18:03:04 UTC, Igor wrote: What exactly do mean by "binding"? If I understand the rest you are saying that I could just use "Add existing item" to add the dllproj.d file to EXEProject as well, but that would cause all of the code from it to be linked in the EXE

Re: How to setup DLL and EXE projects in one VS solution

2017-05-17 Thread Igor via Digitalmars-d-learn
On Wednesday, 17 May 2017 at 17:48:50 UTC, solidstate1991 wrote: I think you should make a binding for your DLL file. On the other hand I successfully set up a static library and an application in the same solution (now it has 2 apps, one is my map editor and file converter, the other is a

How to setup DLL and EXE projects in one VS solution

2017-05-17 Thread Igor via Digitalmars-d-learn
At the moment I have: EXEProject: app.d - it does loadlibrary of dllproj and uses data structures defined in dllproj.d (it imports dllproj). On the file system this file is under /platform/win32/ and is defined as module win32.app; DLLProject dllproj.d - exports functions and contains

Re: Current LDC Android status

2017-05-17 Thread Igor via Digitalmars-d-learn
On Tuesday, 16 May 2017 at 03:00:08 UTC, Mike B Johnson wrote: So what is currently the state of affairs with LDC and android? Last time I remember, it *could* compile to android but barely. About a month ago I tried to build OpenGL sample app following directions from here:

Re: Structure of platform specific vs non platform specific code

2017-05-09 Thread Igor via Digitalmars-d-learn
On Tuesday, 9 May 2017 at 15:37:44 UTC, Stefan Koch wrote: On Tuesday, 9 May 2017 at 15:28:20 UTC, WhatMeWorry wrote: On Monday, 8 May 2017 at 21:16:53 UTC, Igor wrote: Hi, I am following Casey Muratori's Handmade Hero and writing it in DLang. This sounds very interesting. Maybe make it a

Structure of platform specific vs non platform specific code

2017-05-08 Thread Igor via Digitalmars-d-learn
Hi, I am following Casey Muratori's Handmade Hero and writing it in DLang. I got to Day 011: The Basics of Platform API Design where Casey explains the best way to structure platform specific vs non-platform specific code but his method cannot work in DLang since it uses modules and I am

Re: How compiler detects forward reference errors

2016-09-08 Thread Igor via Digitalmars-d-learn
Thank you all for your replies. I am trying to learn a bit about compiler and language design and I really like D among many other languages I read about so I am trying to learn from it as well.

Re: How compiler detects forward reference errors

2016-09-04 Thread Igor via Digitalmars-d-learn
On Saturday, 3 September 2016 at 14:13:27 UTC, Lodovico Giaretta wrote: On Saturday, 3 September 2016 at 14:06:06 UTC, Igor wrote: Can anyone explain in plain English how does compiler process and detect a "test.d(6) Error: forward reference of variable a" in following code: import

View model separation X and D.

2016-01-29 Thread Igor via Digitalmars-d-learn
Suppose I create a model in D and would like it to support a gui written in another language such as Qt C++ or WPF .NET. Can anyone think of an efficient and very easy way to hook up the "bindings"? The gui doesn't need to be updated more than about 30 times a second and it should run in it's

Re: View model separation X and D.

2016-01-29 Thread Igor via Digitalmars-d-learn
On Friday, 29 January 2016 at 20:04:59 UTC, Igor wrote: Suppose I create a model in D and would like it to support a gui written in another language such as Qt C++ or WPF .NET. Can anyone think of an efficient and very easy way to hook up the "bindings"? The gui doesn't need to be updated

Re: how to allocate class without gc?

2016-01-27 Thread Igor via Digitalmars-d-learn
On Wednesday, 27 January 2016 at 06:40:00 UTC, Basile B. wrote: On Tuesday, 26 January 2016 at 01:09:50 UTC, Igor wrote: Is there any examples that shows how to properly allocate an object of a class type with the new allocators and then release it when desired? This is more or less the same

Re: free causes exception

2016-01-27 Thread Igor via Digitalmars-d-learn
On Wednesday, 27 January 2016 at 14:31:20 UTC, Steven Schveighoffer wrote: On 1/26/16 4:23 PM, Igor wrote: On Tuesday, 26 January 2016 at 20:17:20 UTC, Steven Schveighoffer wrote: [...] um? Memory manager? I am doing it manually C++ style so I don't have to worry about the god forsaken

Re: how to allocate class without gc?

2016-01-26 Thread Igor via Digitalmars-d-learn
On Tuesday, 26 January 2016 at 09:32:06 UTC, Daniel Kozak wrote: V Tue, 26 Jan 2016 05:47:42 + Igor via Digitalmars-d-learn <digitalmars-d-learn@puremagic.com> napsáno: [...] Can you try it with GC.disable()? Didn't change anything.

Re: how to allocate class without gc?

2016-01-26 Thread Igor via Digitalmars-d-learn
On Tuesday, 26 January 2016 at 09:32:06 UTC, Daniel Kozak wrote: V Tue, 26 Jan 2016 05:47:42 + Igor via Digitalmars-d-learn <digitalmars-d-learn@puremagic.com> napsáno: On Tuesday, 26 January 2016 at 05:11:54 UTC, Mike Parker wrote: > [...] Can you try it with GC.disable()?

free causes exception

2016-01-26 Thread Igor via Digitalmars-d-learn
I have successfully malloc'ed an object but when I go to free it in the destructor I get an exception. The destructor simply has ~this() // destructor for Foo { core.stdc.stdlib.free(); } auto buffer = core.stdc.stdlib.malloc(__traits(classInstanceSize,

Re: free causes exception

2016-01-26 Thread Igor via Digitalmars-d-learn
On Tuesday, 26 January 2016 at 14:48:48 UTC, Daniel Kozak wrote: V Tue, 26 Jan 2016 14:20:29 + Igor via Digitalmars-d-learn <digitalmars-d-learn@puremagic.com> napsáno: [...] core.stdc.stdlib.free(cast(void *)this); I still get an exception: Exception thrown at 0x7FF6C7

Re: free causes exception

2016-01-26 Thread Igor via Digitalmars-d-learn
On Tuesday, 26 January 2016 at 20:17:20 UTC, Steven Schveighoffer wrote: On 1/26/16 9:20 AM, Igor wrote: I have successfully malloc'ed an object but when I go to free it in the destructor I get an exception. The destructor simply has ~this() // destructor for Foo {

Re: free causes exception

2016-01-26 Thread Igor via Digitalmars-d-learn
On Tuesday, 26 January 2016 at 19:34:22 UTC, Ali Çehreli wrote: On 01/26/2016 06:20 AM, Igor wrote: > I have successfully malloc'ed an object but when I go to free it in the > destructor I get an exception. The destructor simply has > > ~this() // destructor for Foo > { >

Re: nogc Array

2016-01-25 Thread Igor via Digitalmars-d-learn
On Tuesday, 26 January 2016 at 03:06:40 UTC, maik klein wrote: On Tuesday, 26 January 2016 at 03:03:40 UTC, Igor wrote: Is there a GC-less array that we can use out of the box or do I have to create my own? https://dlang.org/phobos/std_container_array.html How do we use std.algorithm with

Re: nogc Array

2016-01-25 Thread Igor via Digitalmars-d-learn
On Tuesday, 26 January 2016 at 04:38:13 UTC, Adam D. Ruppe wrote: On Tuesday, 26 January 2016 at 04:31:07 UTC, Igor wrote: then std.algorithm.find!("a.myInt == b")(classes, 3) Try std.algorithm.find!("a.myInt == b")(classes[], 3) notice the [] after classes I guess std.container.array

Re: how to allocate class without gc?

2016-01-25 Thread Igor via Digitalmars-d-learn
On Tuesday, 26 January 2016 at 05:11:54 UTC, Mike Parker wrote: On Tuesday, 26 January 2016 at 01:09:50 UTC, Igor wrote: Is there any examples that shows how to properly allocate an object of a class type with the new allocators and then release it when desired? Allocate a block of memory

D Dll's usefulness

2016-01-25 Thread Igor via Digitalmars-d-learn
Can D Dll's be linked and used as if they were compiled directly with the program? I was thinking of writing some library routines and put them in a Dll but now I'm not thinking that would be very useful because the Dll's won't export class like behavior. in my DLL: class MyClass { void

Re: D Dll's usefulness

2016-01-25 Thread Igor via Digitalmars-d-learn
On Monday, 25 January 2016 at 21:42:07 UTC, Kagamin wrote: Um... A closed-source library is one thing, DLL is another thing, DLL class library is a third thing, seamless linking of DLL class library is a fourth thing. Well... see what you can get working. Thanks for the help! I really

New Win32 Core api broke?

2016-01-25 Thread Igor via Digitalmars-d-learn
error LNK2019: unresolved external symbol GetStockObject referenced in function _D2Application10createWindowMFPFZvZi (int Application.createWindow(void function()*)) and the line of code is wc.hbrBackground = GetStockObject(WHITE_BRUSH); I've tried to import core.sys.windows.wingdi; But

static assignment

2016-01-25 Thread Igor via Digitalmars-d-learn
how can I have a static assignment static bool isStarted = false; public static Application Start(string Name, void function(Application) entryPoint) { if (isStarted) assert("Can only call Start once"); isStarted = true;

how to allocate class without gc?

2016-01-25 Thread Igor via Digitalmars-d-learn
Is there any examples that shows how to properly allocate an object of a class type with the new allocators and then release it when desired?

nogc Array

2016-01-25 Thread Igor via Digitalmars-d-learn
Is there a GC-less array that we can use out of the box or do I have to create my own?