in reply to Compiling Win32::Lanman for ActivePerl 5.10

The unresolved symbols are exported by netapi32.dll. However, they are exported without the leading underscores, hence why they are not resolved. This is an indication that they are being called with the wrong calling convention--eg. cdecl rather than system or fastcall.

Probably the best way of resolving the issue would be to remove the (faulty?) declarations from dfs.h and include the MS distributed header file: LMDFS.h. If that causes other problems--I'm not in a position right now to try my theories--then copy the MS declarations from that file over those in dfs.h and see what happens. You might need to bring across a few #defines as well if you go this route.


Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.
"Too many [] have been sedated by an oppressive environment of political correctness and risk aversion."

Replies are listed 'Best First'.
Re^2: Compiling Win32::Lanman for ActivePerl 5.10
by szr (Scribe) on Oct 17, 2008 at 14:30 UTC
    Thank you all for your responses. To be clear, dfs.cpp does #include <lmdfs.h> And it seems I have goofed slightly in my descrtiption (apologies.) dfs.h has these declarations that seem to corraspond to the linker errors:
    133: XS(XS_NT__Lanman_NetDfsRename); 154: XS(XS_NT__Lanman_NetDfsMove);
    amd domain.h:
    93: XS(XS_NT__Lanman_NetEnumerateTrustedDomains); 111: XS(XS_NT__Lanman_I_NetGetDCList);
    And these "XS" functions are defined. It's the functions they call from within that's the problem: IE: (dfs.cpp:315)
    XS(XS_NT__Lanman_NetDfsRemove) { [...] LastError(NetDfsRemove(entryPath, server, share)); [...] }
    Interestingly, in domain.h, in the comment block directly preceding "XS(XS_NT__Lanman_NetEnumerateTrustedDomains);" it mentioned the following: (reformated slightly for readability.) domain.h:83
    // important: if you need to compile this module, please change the // function prototype in lmaccess.h to the following: // // NTSTATUS NET_API_FUNCTION NetEnumerateTrustedDomains( // IN LPWSTR ServerName OPTIONAL, OUT LPWSTR *DomainNames);
    This is the best clue I've found so far. Ok, so I opened "C:\Program Files\Microsoft SDK\Include\LMAccess.h" and at line 1378 I see:
    NTSTATUS NET_API_FUNCTION NetEnumerateTrustedDomains ( IN LPWSTR ServerName OPTIONAL, OUT LPWSTR *DomainNames );
    So to be sure I went and opened "C:\Program Files\Microsoft Visual Studio\6.0\VC98\Include\LMACCESS.H" and at line 1311 I see:
    NTSTATUS NetEnumerateTrustedDomains ( IN LPWSTR ServerName OPTIONAL, OUT LPWSTR *DomainNames );
    Which appears to be missing the "NET_API_FUNCTION" part. I added "NET_API_FUNCTION" and deleted "perl.10xx.release\domain.obj" and re-ran "vc6 nmake" (vc6 is a batch file that setups the correct environment for vc6) and domain.obj recompiled but I got the same linker errors. Thank for the help so far. The thing I really don't get is that all the unresolved symbols the linker complains about all have leading underscores (ie, _NetDfsRename, _NetDfsMove, _NetEnumerateTrustedDomains, _I_NetGetDCList) but the actual calls in the .cpp files have no underscores (ie, NetDfsRemove, NetDfsMove, NetEnumerateTrustedDomains, I_NetGetDCList), yet other functions like XS(XS_NT__Lanman_NetDfsRename), which calls NetDfsRename, works fine. Any more insight is very much appreciated.