Forums › General Discussions › What is Loadlibrary doing with sa_api.dll and ftd2xx.dll?
- This topic has 2 replies, 2 voices, and was last updated 5 years, 4 months ago by
HalHoffman.
- AuthorPosts
HalHoffmanParticipantI have a C program that fails to load sa_api.dll.
The main points –
This entry is similar to another one I submitted, “Python 2.7 ctypes sa_api.dll Windows 10 1803 1903”, but is using C instead of Python and attached is a Process Monitor logfile showing thread activity.
You can see from the Process Monitor logfile is that sa_api.dll is loaded and then ftd2xx.dll is loaded. Loadlibrary returns NULL and a call to GetLastError returns 126 which means the module was not found.
This program succeeds on an older computer with Windows 10 1803 and fails on a newer computer with Windows 10 1903 or 1909. I don’t know if that is the cause of the failure but it is a difference.
The details –
The source code –
#include <stdio.h>
#include <windows.h>int main()
{
HINSTANCE ll_handle;
int status;
DWORD err;ll_handle = LoadLibrary(“sa_api.dll”);
if (ll_handle != NULL)
{
printf(“LoadLIbrary returned not NULL. We have a handle.\n”);
}
else
{
err = GetLastError();
printf(“LoadLibrary returned NULL\n”);
printf(“GetLastError %d”, err);
}return 0;
}Compiled with MinGW, gcc 8.2.0
Files in the directory –
sh1.exe
sa_api.dll from Spike 3.4.2
ftd2xx.dll from Spike 3.4.2Running the program on the newer computer with Windows 10 1909 –
>sh1
LoadLibrary returned NULL
GetLastError 126
>Error code 126 is ERROR_MOD_NOT_FOUND, “The specified module could not be found.”
From Process Monitor (sysinternals.com) logfile –
11:53:53.2685325 … Load Image …\sa_api.dll SUCCESS …
11:53:53.2792824 … Load Image …\ftd2xx.dll SUCCESS …Attached is the logfile that shows all the thread activity. It does load both dll’s and every event has a result of SUCCESS.
Do the dlls sa_api.dll and ftd2xx.dll depend on the Microsoft .NET Framework? The older computer has version 4.7.03056 and the new computer has 4.8.03752.
Do you know if these dll’s have run on a computer with Windows 1903 or 1909? Can you try that?
Can you think of any other examination I can do?
Thanks for whatever help you can provide. At this point I can’t use an SA124B or SA44B with a new computer.
–
Attachments:
You must be logged in to view attached files.
AndrewModeratorHi HalHoffman,
The sa_api and ftd2xx DLLs do not depend on anything in the .Net framework but do depend on the VS2012 redistributables. Have you installed those yet? Have you tried using a tool like dependency walker to determine which libraries you might be missing? I believe you can use it on the sa_api DLL. Also if it is a missing library, simply compiling it with the #pragma comment(lib,””) flag will tell you which DLL is missing when you go to run it.
I am running 1909 and have run 1903 in the past, both OS run the sa_api just fine. Does Spike work on these newer computer? If yes, it is probably because the VS2012 redistributables are shipped in the Spike directory.
Regards,
Andrew
HalHoffmanParticipantHi Andrew,
This was helpful and solved the problem.
The new computer came with Microsoft Visual C++ 2015 Redistributable, and I had updated to the newest one, 2015-2019, thinking that might help. On your advice I installed 2012 and then the program worked. I haven’t had to install 2012 up till now so it must have been present on previous computers and not on this newer one.
Thanks for the help!
- AuthorPosts
You must be logged in to reply to this topic.