[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Problem building 0.8.0 with VS 2015


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 <John.Dunn@xxxxxxx <mailto:John.Dunn@xxxxxxx>> 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 <john.dunn@xxxxxxx <mailto:john.dunn@xxxxxxx>>
> <fix_win32_build.patch>


References:
Problem building 0.8.0 with VS 2015John Dunn <John.Dunn@xxxxxxx>
Archive administrator: postmaster@lists.cynapses.org