If nmbd is not running smbc_opendir(ctx, "smb://localhost/") returns NULL.
Expected behaviour: You should still be able to browse hosts without requiring nmbd.
Test program that returns NULL:
int main(int argc, char **argv)
smb_context = smbc_new_context ();
smbc_setDebug (smb_context, 4);
smbc_setOptionDebugToStderr (smb_context, 1);
smbc_opendir = smbc_getFunctionOpendir (smb_context);
dir = smbc_opendir (smb_context, "smb://localhost/");
Created attachment 4615 [details]
Log of running test program without nmbd running
The problem here is not one of nmbd not running. As your test program output shows, the name 'localhost' is being resolved using the "hosts" resolve method, and is being resolved correctly. It's the actual connection to *smbd* that's failing. A debug level 10 at the server (rather than at the client) might help discover why the connection is being refused.
Your test program works for me if I start samba normally then kill nmbd. The connection succeeds. I believe there's something wrong with your test environment.