C# Interop

Robert Jacques sandford at jhu.edu
Tue Feb 1 06:49:50 PST 2011


On Tue, 01 Feb 2011 03:05:13 -0500, Rainer Schuetze <r.sagitario at gmx.de>  
wrote:
>
> Robert Jacques wrote:
>> On Mon, 31 Jan 2011 16:25:11 -0500, Eelco Hoogendoorn  
>> <hoogendoorn.eelco at gmail.com> wrote:
>> [...]
>>  Lastly, D DLLs will only work on Vista/Windows 7/later. They will not  
>> work on XP. This is due to a long known bug with DLLs and thread local  
>> storage in general on XP. Also, you'll have to use 32-bit C# currently,  
>> as DMD isn't 64-bit compatible yet. (Walter is hard at work on a 64-bit  
>> version of DMD, but it will be Linux only at first, with Windows  
>> following sometime later)
>>
>
> XP TLS support with dynamically loaded DLLs is fixed for some time now  
> with a workaround implemented in druntime. Also, DLLs can be used in  
> multi-threading environments.

Yes, I pointed out in another thread that D loading D DLLs can work around  
this issue, but the original post was about calling a D DLL from another  
language, specifically C#, where the limitation in XP still exists. (Of  
course, you might be able to port the work around to C#. Hmm...)

>  > I've listed some example code from my project below:

[snip]

> This DLLMain code is a bit outdated (is it D1?), the current proposed  
> version is here: http://www.digitalmars.com/d/2.0/dll.html

Thanks. It was D2, but it was forked a while ago. Given that the  
recommended way of doing this might change in the future, a string mixin  
in core.dll_helper might be appropriate.


More information about the Digitalmars-d mailing list