FTDI Community

General Category => Discussion - Software => Topic started by: allenhuffman on June 29, 2023, 04:38:49 PM

Title: Building a DLL that uses LibFT4222 and now getting "Unresolved symbol" errors
Post by: allenhuffman on June 29, 2023, 04:38:49 PM
I created a DLL for handling our I2C communications protocol. It requires the LibFT4222-64.dll from FTDI. I am using the LabWindows/CVI 2017 compiler.

Everything has been working fine the past few months, but I was requested to make a 32-bit version of the DLL as well. I only changed a few options in the compiler, and now it won't link.

I even made a new project, brought in my source code and the .lib files, and it does the same. I'm not sure what changed.

Do any of these symbols look familiar? Is this something the FTDI DLL is needing? If I don't have it included, it complains about FT_xxx calls. As soon as I add the .libs, then it goes to these:

Build Status (z.prj - Release64)
 Link z.dll
  error: Undefined symbol '??0exception@std@@QEAA@AEBV01@@Z' referenced in "c:\path\msvc64\LibFT4222-64.lib". 
  error: Undefined symbol '??2@YAPEAX_K@Z' referenced in "c:\path\msvc64\LibFT4222-64.lib". 
  error: Undefined symbol '??3@YAXPEAX@Z' referenced in "c:\path\msvc64\LibFT4222-64.lib". 
  error: Undefined symbol '??_7type_info@@6B@' referenced in "c:\path\msvc64\LibFT4222-64.lib". 
  error: Undefined symbol '??_E?$clone_impl@U?$error_info_injector@Vlock_error@boost@@@exception_detail@boost@@@exception_detail@boost@@UEAAPEAXI@Z' referenced in "c:\path\msvc64\LibFT4222-64.lib". 
  error: Undefined symbol '??_E?$clone_impl@U?$error_info_injector@Vthread_resource_error@boost@@@exception_detail@boost@@@exception_detail@boost@@UEAAPEAXI@Z' referenced in "c:\path\msvc64\LibFT4222-64.lib". 
  error: Undefined symbol '??_E?$error_info_injector@Vlock_error@boost@@@exception_detail@boost@@UEAAPEAXI@Z' referenced in "c:\path\msvc64\LibFT4222-64.lib". 
  error: Undefined symbol '??_E?$error_info_injector@Vthread_resource_error@boost@@@exception_detail@boost@@UEAAPEAXI@Z' referenced in "c:\path\msvc64\LibFT4222-64.lib". 
  error: Undefined symbol '??_ERingQueue@@UEAAPEAXI@Z' referenced in "c:\path\msvc64\LibFT4222-64.lib". 
  error: Undefined symbol '??_ERxBuffer@@UEAAPEAXI@Z' referenced in "c:\path\msvc64\LibFT4222-64.lib". 
  error: Undefined symbol '??_Ebad_alloc@std@@UEAAPEAXI@Z' referenced in "c:\path\msvc64\LibFT4222-64.lib". 
  error: Undefined symbol '??_Eclone_base@exception_detail@boost@@UEAAPEAXI@Z' referenced in "c:\path\msvc64\LibFT4222-64.lib". 
  error: Undefined symbol '??_Elock_error@boost@@UEAAPEAXI@Z' referenced in "c:\path\msvc64\LibFT4222-64.lib". 
  error: Undefined symbol '??_Eruntime_error@std@@UEAAPEAXI@Z' referenced in "c:\path\msvc64\LibFT4222-64.lib". 
  error: Undefined symbol '??_Esystem_error@system@boost@@UEAAPEAXI@Z' referenced in "c:\path\msvc64\LibFT4222-64.lib". 
  error: Undefined symbol '??_Ethread_exception@boost@@UEAAPEAXI@Z' referenced in "c:\path\msvc64\LibFT4222-64.lib". 
  error: Undefined symbol '??_Ethread_resource_error@boost@@UEAAPEAXI@Z' referenced in "c:\path\msvc64\LibFT4222-64.lib". 
  error: Undefined symbol '?generic_category@system@boost@@YAAEBVerror_category@12@XZ' referenced in "c:\path\msvc64\LibFT4222-64.lib". 
  error: Undefined symbol '?system_category@system@boost@@YAAEBVerror_category@12@XZ' referenced in "c:\path\msvc64\LibFT4222-64.lib". 
  error: Undefined symbol '?what@exception@std@@UEBAPEBDXZ' referenced in "c:\path\msvc64\LibFT4222-64.lib". 
  error: Undefined symbol '_CxxThrowException' referenced in "c:\path\msvc64\LibFT4222-64.lib". 
  error: Undefined symbol '__CxxFrameHandler3' referenced in "c:\path\msvc64\LibFT4222-64.lib". 
  error: Undefined symbol '__imp_??0exception@std@@QEAA@AEBQEBD@Z' referenced in "c:\path\msvc64\LibFT4222-64.lib". 
  error: Undefined symbol '__imp_??0exception@std@@QEAA@AEBV01@@Z' referenced in "c:\path\msvc64\LibFT4222-64.lib". 
  error: Undefined symbol '__imp_??1_Container_base12@std@@QEAA@XZ' referenced in "c:\path\msvc64\LibFT4222-64.lib". 
  error: Undefined symbol '__imp_??1exception@std@@UEAA@XZ' referenced in "c:\path\msvc64\LibFT4222-64.lib". 
  error: Undefined symbol '__imp_?_Xlength_error@std@@YAXPEBD@Z' referenced in "c:\path\msvc64\LibFT4222-64.lib". 
  error: Undefined symbol '__imp_?_Xout_of_range@std@@YAXPEBD@Z' referenced in "c:\path\msvc64\LibFT4222-64.lib". 
  error: Undefined symbol '__imp_?what@exception@std@@UEBAPEBDXZ' referenced in "c:\path\msvc64\LibFT4222-64.lib". 
  error: Undefined symbol '_purecall' referenced in "c:\path\msvc64\LibFT4222-64.lib". 
Build failed.
Title: Re: Building a DLL that uses LibFT4222 and now getting "Unresolved symbol" errors
Post by: allenhuffman on June 30, 2023, 02:59:18 PM
Using a DLL dependency walker tool, which I really do not understand how to use, I found some of these unresolved items in:

MSVCR1200.DLL (_purecall, __CppThrowException)

When I used a different walker yesterday, I found them when I clicked on MSVCP100.DLL (VCP versus VCR? I feel like I'm back in the 80s working at the video store.)

In my original project, I never had to do anything except add my sources, tell it to build a DLL, and drag in to .lib files and have the DLL there. I expect something else was making it work - I just have no idea why it stopped working.

Funny enough, I have posted on the LabWindows forum before about MSVCP100.DLL and MSVCR100.DLL. They were required to run out program (using FTDI) and are not part of Windows 10 LTSC. We had to find the MS download that provides them so it could be included with our installer.
Title: Re: Building a DLL that uses LibFT4222 and now getting "Unresolved symbol" errors
Post by: FTDI Community on June 30, 2023, 03:10:14 PM
Hi,

These undefined symbols don't look familiar. The LibFT4222 examples can be build for x86 and x64 which generates a .exe. not a DLL

If the version is lower than or equal to 1.4.4. Libft4222 bases on Microsoft Visual C++ 2010 x86 and x64 Redistributable package.

Please install the below package on the target machine.

https://docs.microsoft.com/en-us/cpp/windows/latest-supported-vc-redist?view=msvc-170
 (https://docs.microsoft.com/en-us/cpp/windows/latest-supported-vc-redist?view=msvc-170)

If the version is higher than or equal to 1.4.5. Microsoft Visual C++ 2010 runtime library is built in LibFt4222. The user does not need to install Microsoft Visual C++ 2010 x86 and x64 Redistributable package on the target machine.

Best Regards
FTDI Community
Title: Re: Building a DLL that uses LibFT4222 and now getting "Unresolved symbol" errors
Post by: allenhuffman on June 30, 2023, 04:23:15 PM
Dependency Walker shows that LibFT4222(-64).dll has MSVCR100.DLL as a dependency, and I see function matches in that DLL, so I am guessing that is what it is looking for. It finds the DLL, but how does it know the functions exist? I thought a .lib was required, like for the FTDI DLLs. (I am an embedded programmer, with no Windows experience beyond the past four years maintaining an existing product.)
Title: Re: Building a DLL that uses LibFT4222 and now getting "Unresolved symbol" errors
Post by: FTDI Community on July 03, 2023, 11:55:15 AM
Hi,

What version of LibFT4222 are you using?

if you are using an old version of the library, then there are such dependencies. But if you are using the latest version, there should be no dependencies.

Best regards

FTDI Community
Title: Re: Building a DLL that uses LibFT4222 and now getting "Unresolved symbol" errors
Post by: allenhuffman on July 03, 2023, 02:41:42 PM
We are using a package numbered 1.4.4 (LibFT4222-v1.4.4.zip), which was the latest the last time I checked.

I will see if there is something newer posted.

Please note -- I was building just fine the past two months, and only when I tried to make a "new" project (creating a 32-bit and 64-bit DLL, instead of just a 64-bit DLL) did I start having these issues. I even made a brand new project, pulling in my .c files and trying to replicate the settings -- same warnings. I expect it's something simple, that was accidentally working in the project I made two months ago.

Title: Re: Building a DLL that uses LibFT4222 and now getting "Unresolved symbol" errors
Post by: allenhuffman on July 03, 2023, 02:53:03 PM
I found that there is a 1.4.5 linked here:

https://ftdichip.com/software-examples/ft4222h-software-examples/

I had a hard time finding it this time -- ended up using a search engine. I'm not sure how to get to it directly on the site.
Title: Re: Building a DLL that uses LibFT4222 and now getting "Unresolved symbol" errors
Post by: allenhuffman on July 05, 2023, 02:48:48 PM
1.4.5 has taken care of the compiler errors. I still have no idea how I was using 1.4.4 fine for two months before it suddenly "broke" when I tried to make a 32-bit DLL.