I'm not 100% new to C++, but it has been a while since I have used it. That said, I don't believe that this problem has much to do with syntax (though it would be nice to find a simple solution like that).
The error that I'm dealing with comes when trying to load a third-party dll (using LoadLibrary). GetLastError() returns 0x000036b1, which, as far as I know, is the same as 14001, which deals with side-by-side configuration, which I still need to familiarize myself more with. I had attempted the same types of calls in vb.net, and I had received similar errors dealing with side-by-side configuration.
Even after this problem is solved, I know I will still have others. We are dealing with two different companies. Even being a novice programmer, I had no problem interfacing with the .dll from Company 1, which performs the same basic function as the dll I am having problems with currently (from Company 2). Here is an overview of how the dll from Company 2 functions:
The functions in the 3rd party .dll I am using all deal in one way or another with Handle types (either returning them or accepting them as parameters). One function accepts an ip address and a port number and returns a Handle to the network device if found. The remainder of the functions accept that Handle to the specified network device and perform some kind of operation on it. The function that returns the Handle returns NULL if the function fails to find the device.
Back to the side-by-side error. I copied the following message from eventviewer:
Activation context generation failed for "C:\testpath\WirelessTest\Debug\netclient2.dll". Dependent Assembly Microsoft.VC90.DebugCRT,processorArchitecture="x86",publicKeyToken="1fc8b3b9a1e18e3b",type="win32",version="9.0.21022.8" could not be found. Please use sxstrace.exe for detailed diagnosis.
Running sxstrace, I came up with the following log:
=================
Begin Activation Context Generation.
Input Parameter:
Flags = 0
ProcessorArchitecture = Wow32
CultureFallBacks = en-US;en
ManifestPath = C:\testpath\WirelessTest\Debug\netclient2.dll
AssemblyDirectory = C:\testpath\WirelessTest\Debug\
Application Config File =
-----------------
INFO: Parsing Manifest File C:\testpath\WirelessTest\Debug\netclient2.dll.
INFO: Manifest Definition Identity is (null).
INFO: Reference: Microsoft.VC90.DebugCRT,processorArchitecture="x86",publicKeyToken="1fc8b3b9a1e18e3b",type="win32",version="9.0.21022.8"
INFO: Resolving reference Microsoft.VC90.DebugCRT,processorArchitecture="x86",publicKeyToken="1fc8b3b9a1e18e3b",type="win32",version="9.0.21022.8".
INFO: Resolving reference for ProcessorArchitecture WOW64.
INFO: Resolving reference for culture Neutral.
INFO: Applying Binding Policy.
INFO: No publisher policy found.
INFO: No binding policy redirect found.
INFO: Begin assembly probing.
INFO: Did not find the assembly in WinSxS.
INFO: Attempt to probe manifest at C:\Windows\assembly\GAC_32\Microsoft.VC90.DebugCRT\9.0.21022.8__1fc8b3b9a1e18e3b\Microsoft.VC90.DebugCRT.DLL.
INFO: Did not find manifest for culture Neutral.
INFO: End assembly probing.
INFO: Resolving reference for ProcessorArchitecture x86.
INFO: Resolving reference for culture Neutral.
INFO: Applying Binding Policy.
INFO: No publisher policy found.
INFO: No binding policy redirect found.
INFO: Begin assembly probing.
INFO: Did not find the assembly in WinSxS.
INFO: Attempt to probe manifest at C:\Windows\assembly\GAC_32\Microsoft.VC90.DebugCRT\9.0.21022.8__1fc8b3b9a1e18e3b\Microsoft.VC90.DebugCRT.DLL.
INFO: Attempt to probe manifest at C:\testpath\WirelessTest\Debug\Microsoft.VC90.DebugCRT.DLL.
INFO: Attempt to probe manifest at C:\testpath\WirelessTest\Debug\Microsoft.VC90.DebugCRT.MANIFEST.
INFO: Attempt to probe manifest at C:\testpath\WirelessTest\Debug\Microsoft.VC90.DebugCRT\Microsoft.VC90.DebugCRT.DLL.
INFO: Attempt to probe manifest at C:\testpath\WirelessTest\Debug\Microsoft.VC90.DebugCRT\Microsoft.VC90.DebugCRT.MANIFEST.
INFO: Did not find manifest for culture Neutral.
INFO: End assembly probing.
ERROR: Cannot resolve reference Microsoft.VC90.DebugCRT,processorArchitecture="x86",publicKeyToken="1fc8b3b9a1e18e3b",type="win32",version="9.0.21022.8".
ERROR: Activation Context generation failed.
End Activation Context Generation.
====================
Now, I do have a 64-bit OS, but the dll itself is built for 32-bit, and the source code is not available to me.
One final thing I noticed when stepping through the code: when LoadLibrary() is executed, the output window shows that netclient2.dll is loaded and then immediately unloaded, which is weird. Anyway, sorry for making the post so long. I just wanted to be sure I provided enough info. You can see the code if you want, but it is just a simple LoadLibrary() call.
Thanks in advance to anyone who helps. This is going to be a long process for me (barring a sudden miracle).
EDIT: I just read that the dll loading and immediately unloading could mean that the DLLMain function returned FALSE. Could this also mean an error in the DLLMain function? In the past I had tried to register the dll and it was not found to be a valid DLL file. But the same was true of the DLL from Company #1, which works fine. Would it help or is it even possible to prevent DLLMain from being run without preventing the use of the other functions contained within the dll?