Given what those attributes do that is probably an incomplete solution. 

https://www.geeksforgeeks.org/__attribute__constructor-__attribute__destructor-syntaxes-c/
 
<https://www.geeksforgeeks.org/__attribute__constructor-__attribute__destructor-syntaxes-c/>

To get a similar effect you probably need to construct a dlmain that calls the 
constructor function on DLL_PROCESS_ATTACH and the destructor one on 
DLL_PROCESS_DETACH

> On Aug 10, 2018, at 11:42 AM, John Dunn <[email protected] 
> <mailto:[email protected]>> wrote:
> 
> Hello
> 
> I'm trying to build the 0.8.0 tag from git using VS 2015 and am having 
> compile issues. I'm using the CMake 3.11.0 GUI on windows to configure. The 
> configuration works fine but when I open the generated solutions the projects 
> don't build. When building ssh_shared I get the following error
> 
>       2>C:\code\libssh\libssh\src\init.c(47): error C2061: syntax error: 
> identifier '__attribute__'
> 
> I believe this is due to these defines in init.c
> 
>       #define CONSTRUCTOR_ATTRIBUTE __attribute__((constructor))
>       #define DESTRUCTOR_ATTRIBUTE __attribute__((destructor))
> 
> On Win32, defining as 
> 
>       #define CONSTRUCTOR_ATTRIBUTE
>       #define DESTRUCTOR_ATTRIBUTE
> 
> Appears to fix the problem. I've attached a patch that addresses this issue. 
> Please let me know if there is an issue with my change or if the patch is 
> incorrectly formatted.
> 
> Thanks
> John
> 
> Signed-off-by: John Dunn <[email protected] <mailto:[email protected]>>
> <fix_win32_build.patch>

Reply via email to