www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - Should this work: export extern(C) auto ...

reply =?iso-8859-1?Q?Robert_M._M=FCnch?= <robert.muench saphirion.com> writes:
Windows, 32-Bit, DLL:

export extern(C) struct1 struct1(){
  struct1 x;
  return(x);
}

export extern(C) auto struct2(){
  struct1 x;
  return(x);
}

struct1 is visible in the DLL, struct2 is not visible in the DLL.

-- 
Robert M. Münch
http://www.saphirion.com
smarter | better | faster
Mar 18 2015
parent reply "Adam D. Ruppe" <destructionator gmail.com> writes:
On Wednesday, 18 March 2015 at 15:50:16 UTC, Robert M. Münch 
wrote:
 struct1 is visible in the DLL, struct2 is not visible in the 
 DLL.
It will not work because a function with an auto return value is actually a template, and unused templates won't be put into a dll.
Mar 18 2015
parent reply =?iso-8859-1?Q?Robert_M._M=FCnch?= <robert.muench saphirion.com> writes:
On 2015-03-18 21:50:39 +0000, Adam D. Ruppe said:

 It will not work because a function with an auto return value is 
 actually a template, and unused templates won't be put into a dll.
Ok, that makes it clear. Thanks. -- Robert M. Münch http://www.saphirion.com smarter | better | faster
Mar 19 2015
parent reply "Benjamin Thaut" <code benjamin-thaut.de> writes:
On Thursday, 19 March 2015 at 12:58:42 UTC, Robert M. Münch wrote:
 On 2015-03-18 21:50:39 +0000, Adam D. Ruppe said:

 It will not work because a function with an auto return value 
 is actually a template, and unused templates won't be put into 
 a dll.
Ok, that makes it clear. Thanks.
Generally don't expect to many things to work with DLLs at the moment. Generally speaking only exporting global functions works. Don't try to export classes / structs or anything fancy.
Mar 19 2015
parent =?iso-8859-1?Q?Robert_M._M=FCnch?= <robert.muench saphirion.com> writes:
On 2015-03-19 13:22:44 +0000, Benjamin Thaut said:

 Generally don't expect to many things to work with DLLs at the moment.
Hi, well, I think what's available is good enough to get most things done.
 Generally speaking only exporting global functions works. Don't try to 
 export classes / structs or anything fancy.
I prefer dead-old-style plain & simple C functions in DLLs with a super simple interface based on basic types. Works bests, is stable, can be maintained and is easy to use. So, no fancy stuff needed in my case :-) -- Robert M. Münch http://www.saphirion.com smarter | better | faster
Mar 20 2015