how to export callbacks on win64?

Laeeth Isharc via digitalmars-d-ldc digitalmars-d-ldc at puremagic.com
Wed Oct 26 18:05:34 PDT 2016


On Tuesday, 25 October 2016 at 21:28:50 UTC, captaindet wrote:
> i appreciate that you are trying to help. however, you are 
> indicating workarounds for something that should work out of 
> the box.
>
> again, D has the export attribute for this reason
> https://dlang.org/spec/attribute.html
> and my code/use-case works fine with DMD (and the MS linker).
>
> the lack of replies addressing the root problem seems to 
> indicate that LDC does not respect the export attribute. maybe 
> i should file a bug.
>
> On 2016-10-26 01:10, Kagamin wrote:
> > You can also use the /export option:
> > https://msdn.microsoft.com/en-us/library/7k30y2k5.aspx
>
> these workarounds don't work for me. with respect to the three 
> methods given under 'remarks' (see your link):
>
> > 1. __declspec(dllexport) in the source code
>
> as i understand it, this is what D's export attribute is 
> supposed to trigger. but it does not seem to work with LDC.
>
> > 2. An EXPORTS statement in a .def file
> > 3. An /EXPORT specification in a LINK command
>
> out of the question for my use-case. i got a large number of 
> such callback functions and - and this is the real deal-breaker 
> - they are generated and mixed in during CT. even if i could 
> produce a .def file or linker commands during CT (which is 
> currently not possible nor is it a desirable route to go), they 
> would not be used for that compilation.
>
> as it stands this is a blocker for me, meaning i cannot use LDC 
> for my project.
>
> /det

Fwiw we have a similar problem with generating excel bindings for 
D functions programmatically.   Current approach will be to 
compile once with a version switch to generate a main that 
produces a DEF file,  run main,  then build without the version 
switch using the DEF file produced in the first stage.   You 
don't need to compile the whole program again if it is built as a 
library.   There may be a better option,  but haven't been able 
to think of one.




More information about the digitalmars-d-ldc mailing list