Page MenuHomePhabricator

static win32 lib contains dllmain since 0.8.x
Closed, ResolvedPublic


Notepad++ plugin NppFTP ( uses libssh as static plugin for sftp connections.

With update from 0.7.5 -> 0.8.x there is an issue with ssh_connect() leading to

[NppFTP] Everything initialized
[SFTP] Connection failed : Failed to resolve hostname (Die Anwendung hat die Funktion WSAStartup nicht aufgerufen, oder bei dieser Funktion ist ein Fehler aufgetreten. )
Unable to connect

Seems WSAStartup() is no longer called automatically. Just adding WSAStartup() leads to a crash.

Therefore it seems ssh_init() needs to be called, which leads to a linker issue, see

"C:\projects\nppftp\_build\ALL_BUILD.vcxproj" (default target) (1) ->
"C:\projects\nppftp\_build\NppFTP.vcxproj" (default target) (3) ->
(Link target) -> 
  ssh.lib(init.c.obj) : error LNK2005: DllMain already defined in PluginInterface.obj [C:\projects\nppftp\_build\NppFTP.vcxproj]
  C:\projects\nppftp\_build\Release\NppFTP.dll : fatal error LNK1169: one or more multiply defined symbols found [C:\projects\nppftp\_build\NppFTP.vcxproj]

Could you please move dllmain to a seperate compilation unit or add some ifdef around it to avoid compilation for the static lib case.

Further notice:

  • linking libssh as separate dll is working fine, but distribution of the plugin as single dll is much easier.
  • seems this issue just shows up for the microsoft compiler, mingw seems to be able to handle it, see

Event Timeline

chcg created this task.Oct 4 2018, 12:49 PM
chcg updated the task description. (Show Details)Oct 4 2018, 1:20 PM
asn closed this task as Resolved.Oct 9 2018, 2:23 PM
asn claimed this task.
asn added a subscriber: asn.
chcg added a comment.Oct 10 2018, 1:39 PM

Thank you for the fast correction. :-)