GC seems to crash my C-code function

bauss jj_1337 at live.dk
Thu Sep 16 11:54:20 UTC 2021


On Thursday, 16 September 2021 at 11:35:27 UTC, frame wrote:
> On Thursday, 16 September 2021 at 11:11:56 UTC, bauss wrote:
>> On Thursday, 16 September 2021 at 11:06:04 UTC, frame wrote:
>>> On Thursday, 16 September 2021 at 10:48:19 UTC, bauss wrote:
>>>
>>>>
>>>> Use toStringz and not .ptr.
>>>>
>>>> Or append \0 to your string.
>>>
>>> Stupid me should really know that already, thanks =)
>>> Of course I have dup'ed the \0 from the string away...
>>>
>>> But still I don't know why it works if the GC is off?
>>
>> Did you see my second response?
>
> Yes, but as I mentioned this pointer data isn't hold outside 
> the function and the GC collect runs after data is processed, 
> not in between. This pointer should be fully stack allocated 
> and also newly generated each time the function is called, so I 
> see no impact by the GC?
>
> But GC collecting works now without issues.

My guess is something is undefined behavior in the C code, idk 
really


More information about the Digitalmars-d-learn mailing list