Creating 32-bit import libraries for FreeBasic

Started by Paul Squires, June 11, 2025, 07:50:53 PM

Previous topic - Next topic

Paul Squires

Myself and José have been dealing with this issue a lot lately over email.

We can easily create the 64-bit import libraries from existing Windows system DLL's (eg. user32.dll), however the 32-bit DLL's have been a problem due to the way the current set of available tools handle (or lack handling) creating the necessary symbol decorations.

We have used every combination of gendef, pexports, and dlltool, with varying degrees of succes.

However, the approach used is the following thread with the tool reimp whereby the def file is built from Microsoft's *.LIB files rather than the *.DLL's has proved successful.
https://www.planetsquires.com/protect/forum/index.php?msg=28374

For example, here is the batch file I used based on my system paths. I have Visual Studio Community 2022 installed in order to get access to the LIB's. I am also using the dlltool that ships with the current FreeBasic compiler rather than the latest dlltool version in order to ensure binary compatibility.

@echo off
reimp32 -d "C:\Program Files (x86)\Windows Kits\10\Lib\10.0.26100.0\um\x86\User32.Lib"
c:\dev\tiko_editor\toolchains\FreeBASIC-1.10.1-winlibs-gcc-9.3.0\bin\win32\dlltool -k -d user32.def -l libuser32.dll.a


Paul Squires
PlanetSquires Software