Is there any convenient CopyMemory function in Phobos?
Johannes Pfau
spam at example.com
Tue Jun 14 03:39:49 PDT 2011
Jonathan M Davis wrote:
>On 2011-06-13 17:38, Andrej Mitrovic wrote:
>> So why's it in core.stdc.string, instead of say.. core.memory?
>>
>> Btw, I've had some imports already in the module and it seems these
>> two conflict:
>>
>> import core.thread;
>> import core.stdc.string;
>>
>> void main()
>> {
>> int* p, x;
>> memcpy(p, x, 1);
>> }
>>
>> test.d(9): Error: core.stdc.string.memcpy at
>> D:\DMD\dmd2\windows\bin\..\..\src\druntime\import\core\stdc\string.di(11)
>> conflicts with core.thread.memcpy at
>> D:\DMD\dmd2\windows\bin\..\..\src\druntime\import\core\thread.di(37)
>
>core.thread has its own private declaration of memcpy (IIRC, they
>don't match for some reason). Why a private declaration conflicts, I
>don't know. That certainly _sounds_ like a bug. Regardless, I have no
>clue why those declarations are where they are. I would have expected
>something like core.memory, but they seem to be strewn about druntime.
>That should probably be improved. I just grepped druntime to find
>where memcpy's declaration was. I don't know why it is where it is.
>
>- Jonathan M Davis
The druntime C bindings follow the names of the C
header files. memcpy is in 'string.h' in C --> 'core.stdc.string' in D.
--
Johannes Pfau
More information about the Digitalmars-d-learn
mailing list