Recent

Author Topic: Linking a PortAudio static library with C++ objects into a Lazarus Win64 Exe  (Read 706 times)

bbrx

  • New Member
  • *
  • Posts: 26
Hello,

I am trying to statically link PortAudio with AsioSDK into my Win64 application (Lazarus / FPC)

Context:

- Lazarus 4.6
- Free Pascal 3.3.1 from fpcupdeluxe
- Target: Win64 / x86_64
- LCL widgetset: Win32
- Windows 64-bit
- PortAudio built with MSYS2 MinGW64 / GCC 16.1.0 / Ninja
- PortAudio was built as a static library: libportaudio.a
- Enabled PortAudio backends:
  - WASAPI
  - WMME
  - ASIO
- The ASIO backend introduces C++ object files into libportaudio.a

PortAudio builds successfully with CMake/Ninja and produces libportaudio.a.

The issue:

If I use the default FPC linker from fpcupdeluxe, I get problems with the MinGW/GCC objects, for example:

Dwarf Error: found dwarf version '5', this reader only handles version 2, 3 and 4 information.

So I tried using the external MinGW linker with:

-Xe
-FDC:\msys64\mingw64\bin

But then the MinGW linker fails on LCL object files, for example:

C:\msys64\mingw64\bin\ld.exe: C:\lazarus-4-2-6\lcl\units\x86_64-win64\graphics.o: illegal relocation type 0 at address 0

This suggests that the MSYS2/MinGW ld.exe is not compatible with some precompiled Lazarus/LCL object files.

I also tried generating ppas.bat with -s. When using the FPC linker, ppas.bat shows that it calls:

C:\fpcupdeluxe\fpc\bin\x86_64-win64\ld.exe

When using the MSYS2 linker, it fails with the LCL graphics.o illegal relocation errors.

My questions:

1. Is there a recommended way to link a MinGW-w64 static library containing C++ objects into a Lazarus Win64 exe?

2. Should Lazarus/LCL packages be rebuilt with specific options to make their .o files compatible with the MSYS2 MinGW ld.exe?

3. Is it better to rebuild PortAudio with specific flags, such as:
   -g0
   -fno-stack-protector
   possibly with an older MinGW-w64/GCC toolchain?

4. Is there a known incompatibility between recent MSYS2 binutils/GCC and FPC/Lazarus-generated Win64 object files?

5. Would the recommended solution be to avoid the MSYS2 linker and instead make the static library compatible with the FPC-provided linker?

My goal is to keep PortAudio statically linked into the final executable, not to use a separate DLL.

Any advice or known working setup would be appreciated.

Thank you for your help

Thaddy

  • Hero Member
  • *****
  • Posts: 19268
  • Glad to be alive.
The good news is that the ASIO 64 bit version directly links. (It uses WDM internally)
I tested the latter against Steinberg's universal 64 bit ASIO driver.
You actually don't link: just the Pascal header, calling conventions removed. (ASIO64 uses the Win64 ABI correctly, as opposed to the 32 bit code that used COM with __thiscall)

BTW: ASIO64 is compiled with Microsoft compilers not any of the compilers you are trying to use.
But the MS compilers are also free. That is likely the cause of your issues....

So for the ASIO64 part you don't need anything, let alone C++ code. Just the Pascal header.
« Last Edit: May 17, 2026, 07:56:50 am by Thaddy »
objects are fine constructs. You can even initialize them with constructors.

bbrx

  • New Member
  • *
  • Posts: 26
Hello Thaddy,

Thank you for your answer.

Just to confirm: are you suggesting not to use PortAudio’s ASIO backend at all, but instead call the ASIO 64-bit driver interface directly from Pascal?

Do you know of an existing Pascal ASIO64 header/unit that works with Win64/FPC, or should I translate the ASIO 64-bit interfaces manually from the Steinberg SDK?

My understanding is now:

- PortAudio + ASIO requires compiling/linking the C++ ASIO SDK files (*.cpp)

- This creates the libstdc++ / libgcc / MinGW linker issues I am seeing.

- A direct ASIO64 Pascal binding may avoid that because Win64 uses a unified calling convention and does not have the old 32-bit __thiscall problem.

Is that correct?

The MSVC compiler would produce a .lib file, while my current Lazarus/FPC setup is based on MinGW-style .a static libraries.

Maybe I am wrong, but I assumed that Lazarus/FPC on Windows links more naturally against MinGW .a static libraries than against MSVC .lib files, especially when C++ objects are involved.

Would using MSVC to build PortAudio/ASIO as a static .lib be a better approach for FPC/Lazarus, or would that create another ABI/linker compatibility issue?

My concern is that MinGW-generated .a files seem easier to pass to FPC, but the MinGW C++ runtime creates problems with ASIO, while MSVC may match Steinberg’s ASIO SDK better but may be harder to link statically from Lazarus/FPC.

Regards,


« Last Edit: May 17, 2026, 10:09:09 am by bbrx »

Thaddy

  • Hero Member
  • *****
  • Posts: 19268
  • Glad to be alive.
I simply used my existing interface I published in the early 2000's and removed the calling stuff.
And yes, you don't need the PortAudio one on windows: simply use the original one from Steinberg.
https://helpcenter.steinberg.de/hc/en-us/articles/17863730844946-Steinberg-built-in-ASIO-Driver-information-download
The old header will simply work. Also on win10/64 and win11/arm

This works with THESE headers;
https://www.fredericvanmol.be/asio.html

DO NOT USE ANY OTHERS. These headers are prepared for 64/32 bit and better than the Bero version - never was correct - in the ASIOVST package. The 64 bit version does not use assembler, not needed.
Even the class is not needed: you can use the interface directly. But at least you can choose.
« Last Edit: May 17, 2026, 11:16:28 am by Thaddy »
objects are fine constructs. You can even initialize them with constructors.

Fred vS

  • Hero Member
  • *****
  • Posts: 3946
    • StrumPract is the musicians best friend
Hello.

Maybe you can try with the pre-compiled libs from https://github.com/shivang51/portaudio/tree/main/lib/Static .
They are compiled using pa_asio.h.
Rename the .lib file to libportaudio.a so FPC's built-in linker recognizes it smoothly on Windows systems.

Good luck (and patience).
« Last Edit: May 18, 2026, 06:10:18 pm by Fred vS »
I use Lazarus 2.2.0 32/64 and FPC 3.2.2 32/64 on Debian 11 64 bit, Windows 10, Windows 7 32/64, Windows XP 32,  FreeBSD 64.
Widgetset: fpGUI, MSEgui, Win32, GTK2, Qt.

https://github.com/fredvs
https://gitlab.com/fredvs
https://codeberg.org/fredvs

Fred vS

  • Hero Member
  • *****
  • Posts: 3946
    • StrumPract is the musicians best friend
Re-hello.

I did cross-compile portaudio static libs with asio support from linux to windows 32/64 with .a format using mingw.

Here the libs: https://github.com/fredvs/portaudio-static/releases/tag/1

Hope it helps.

[EDIT] Updated with correct asio-sdk and added scripts I used to build it.
« Last Edit: May 19, 2026, 02:04:53 am by Fred vS »
I use Lazarus 2.2.0 32/64 and FPC 3.2.2 32/64 on Debian 11 64 bit, Windows 10, Windows 7 32/64, Windows XP 32,  FreeBSD 64.
Widgetset: fpGUI, MSEgui, Win32, GTK2, Qt.

https://github.com/fredvs
https://gitlab.com/fredvs
https://codeberg.org/fredvs

Thaddy

  • Hero Member
  • *****
  • Posts: 19268
  • Glad to be alive.
@Fred vS

Very helpful, thanks, my version did need some small tinkering for fpc (handles, GUID, and this looks better.
I will need to evaluate, though, if my old software - and current hardware: Old Firefly 302 - still ports.
Also note that on Windows 11 I discovered it actually comes with an ASIO driver as default for e.g. Realtek hardware. This only showed up after I made the 64 bit port of my old ASIO library.
(That is the one - the FPC one - later claimed by cwbudde without reference, but I wrote together with TobyBear helped by Frederic vanMol (FL Studio) who wrote the original Delphi headers. Not the only code from me he claims as his: the translation of Freereverb3 by JaZar is also my code, where he actually forgot to credit us both and left in my comments....and renamed it... I also wrote the original VST host for Delphi, also with TobyBear who tested and commented on it until it worked, for Delphi, which also lives on in the AsioVst package UNcredited but I can prove it it is mine and he knows that. No problem, but don't claim it under your own name. I never got a reply when I confronted Christian with that. Still bugs me a bit. Then again: some of the contributions he DID write himself were very valuable. Credit where credit is due. That includes the packaging for example. When we (TobyBear the VST's and me the host) wrote all that code Christian was not even proficient in Pascal. All other things included in AsioVst he probably DID write himself. Both TobyBear and me lost a bit of interest. I give him much, much, credit for that. If only he could do the same...Others, in the same time period, did give me proper credits e.g. on dsp-worx or if you have an undamaged musicdsp.org archive > from before 2005-2010 - the current one is damaged by spam and hacks, but now safe (Thanks, Bram) at the cost of a lot of entries. Still contains good Pascal code, but almost all entries from TobyBear and me and many others are lost from ~2000 to ~2005, including all my RBJ filter translations and all oscillators in Pascal in the current left-over) end-of-rant. Correction: at least the RBJ filters are still in with my comments, but all email addresses have been replaced with bogus so hard to recognize after the 2006 attacks. Everything older has been post-dated to 2006.
« Last Edit: May 20, 2026, 07:44:29 am by Thaddy »
objects are fine constructs. You can even initialize them with constructors.

bbrx

  • New Member
  • *
  • Posts: 26
Thanks Fred vS and Thaddy for your help!
I'll try soonly :)

bbrx

  • New Member
  • *
  • Posts: 26
Hello Fred,

Nice job, How did you go about compiling it?
If I (or someone else) ever need to reproduce it.

I need to understand which parameters and windows backend(MME,WASAPI,WDMKS or ASIO) it's was used for the compilation.

Regards,


Re-hello.

I did cross-compile portaudio static libs with asio support from linux to windows 32/64 with .a format using mingw.

Here the libs: https://github.com/fredvs/portaudio-static/releases/tag/1

Hope it helps.

[EDIT] Updated with correct asio-sdk and added scripts I used to build it.
« Last Edit: May 20, 2026, 11:46:36 am by bbrx »

Fred vS

  • Hero Member
  • *****
  • Posts: 3946
    • StrumPract is the musicians best friend
Hello Fred,

Nice job, How did you go about compiling it?
If I (or someone else) ever need to reproduce it.

I need to understand which parameters and windows backend(MME,WASAPI,WDMKS or ASIO) it's was used for the compilation.

Regards,


I did cross-compile from Linux 64 to Windows 64/32.
You may take a look at https://github.com/fredvs/portaudio-static there is the script cross_compile_portaudio_win32-64.sh, it should work out-of-the-box.

Copy the script and paste it in a new folder (ex static-portaudio), set the script as executable and run it:
Code: Pascal  [Select][+][-]
  1. cd static-portaudio
  2. chmod +x cross_compile_win_32-64.sh
  3. ./cross_compile_portaudio_win32-64.sh

You will need to install this before running the script:

Code: Pascal  [Select][+][-]
  1. sudo apt update
  2. sudo apt install -y mingw-w64 cmake git build-essential

Maybe it is possible to create the static lib with asio included directly from a Windows system but I did not try, I feel it more easy to use cross-compilation from linux.

About using the static lib in fpc, I was able to do it for linux, it works great but I did not try to do it for windows (in fact I did try to do it with wine on linux but I fail, maybe do it directly from windows will be easier).

First paste libportaudio.a in the root directory of the project and this is the command I used to compìle it on linux:

Code: Pascal  [Select][+][-]
  1. fpc -FUunits -Fl. -k"--copy-dt-needed-entries" -k"--start-group" -k"-lportaudio" -k"-lpthread" -k"-lc" -k"--end-group" portaudio_demo.pas

For windows I did not try, I dont have a Windows machine at the moment but you may use the binary of static libportaudio.a from my site.

Good luck.

Fred
« Last Edit: May 20, 2026, 01:17:22 pm by Fred vS »
I use Lazarus 2.2.0 32/64 and FPC 3.2.2 32/64 on Debian 11 64 bit, Windows 10, Windows 7 32/64, Windows XP 32,  FreeBSD 64.
Widgetset: fpGUI, MSEgui, Win32, GTK2, Qt.

https://github.com/fredvs
https://gitlab.com/fredvs
https://codeberg.org/fredvs

bbrx

  • New Member
  • *
  • Posts: 26
Hello Fred,

Nice job, How did you go about compiling it?
If I (or someone else) ever need to reproduce it.

I need to understand which parameters and windows backend(MME,WASAPI,WDMKS or ASIO) it's was used for the compilation.

Regards,


I did cross-compile from Linux 64 to Windows 64/32.
You may take a look at https://github.com/fredvs/portaudio-static there is the script cross_compile_portaudio_win32-64.sh, it should work out-of-the-box.

Copy the script in a new folder (ex static-portaudio), set the script as executable and run it:
Code: Pascal  [Select][+][-]
  1. cd static-portaudio
  2. chmod +x cross_compile_win_32-64.sh
  3. ./cross_compile_portaudio_win32-64.sh

You will need to install this before running the script:

Code: Pascal  [Select][+][-]
  1. sudo apt update
  2. sudo apt install -y mingw-w64 cmake git build-essential

Maybe it is possible to create the static lib with asio included directly from a Windows system but I did not try, I feel it more easy to use cross-compilation from linux.

About using the static lib in fpc, I was able to do it for linux, it works great but I did not try to do it for windows (in fact I did try to do it with wine on linux but I fail, maybe do it directly from windows will be easier).

First paste libportaudio.a in the root directory of the project and this is the command I used to compìle it on linux:

Code: Pascal  [Select][+][-]
  1. fpc -FUunits -Fl. -k"--copy-dt-needed-entries" -k"--start-group" -k"-lportaudio" -k"-lpthread" -k"-lc" -k"--end-group" portaudio_demo.pas

For windows I did not try, I dont have a Windows machine at the moment but you may use the binary of static libportaudio.a from my site.

Good luck.

Fred

Thanks Fred for the detail, I see 2 folders on archive "libportaudio-static-windows" and "windows-static" with 2 differents file size? also I noticed you don't use -Xe.
I tried without using linklib using this command :

I created build.bat using :

@echo off
set FPC=C:\fpcupdeluxe\fpc\bin\x86_64-win64\fpc.exe

if not exist units mkdir units

%FPC% ^
  -B ^
  -MObjFPC ^
  -Sh ^
  -Twin64 ^
  -Px86_64 ^
  -FUunits ^
  -Fu. ^
  -FlC:\msys64\home\dev\portaudio\build-ninja ^
  -FlC:\msys64\mingw64\lib ^
  -FlC:\msys64\mingw64\lib\gcc\x86_64-w64-mingw32\16.1.0 ^
  -k"--start-group" ^
  -k"-lstdc++" ^
  -k"-lsupc++" ^
  -k"-lgcc_eh" ^
  -k"-lgcc" ^
  -k"-lwinpthread" ^
  -k"-lmingwex" ^
  -k"-lmoldname" ^
  -k"-lmsvcrt" ^
  -k"-lwinmm" ^
  -k"-lole32" ^
  -k"-loleaut32" ^
  -k"-luuid" ^
  -k"-lsetupapi" ^
  -k"-ladvapi32" ^
  -k"-lavrt" ^
  -k"-lkernel32" ^
  -k"-luser32" ^
  -k"--end-group" ^
  test_portaudio_static.lpr

pause

but I got error without $LINKLIB in Portaudio wrapper :

"Free Pascal Compiler version 3.3.1-20107-g8594e9ad47-dirty [2026/04/28] for x86_64
Copyright (c) 1993-2026 by Florian Klaempfl and others
Target OS: Win64 for x64
Compiling test_portaudio_static.lpr
Compiling uportaudiostatic.pas
Linking test_portaudio_static.exe
test_portaudio_static.lpr(30,1) Error: Undefined symbol: strncpy (first seen in libportaudio.a(pa_front.c.obj))
test_portaudio_static.lpr(30,1) Error: Undefined symbol: __imp_GlobalAlloc (first seen in libportaudio.a(pa_win_util.c.obj))
test_portaudio_static.lpr(30,1) Error: Undefined symbol: __imp_GlobalFree (first seen in libportaudio.a(pa_win_util.c.obj))
test_portaudio_static.lpr(30,1) Error: Undefined symbol: __imp_Sleep (first seen in libportaudio.a(pa_win_util.c.obj))
test_portaudio_static.lpr(30,1) Error: Undefined symbol: __imp_QueryPerformanceFrequency (first seen in libportaudio.a(pa_win_util.c.obj))
test_portaudio_static.lpr(30,1) Error: Undefined symbol: __imp_QueryPerformanceCounter (first seen in libportaudio.a(pa_win_util.c.obj))
test_portaudio_static.lpr(30,1) Error: Undefined symbol: __imp_timeGetTime (first seen in libportaudio.a(pa_win_util.c.obj))
test_portaudio_static.lpr(30,1) Error: Undefined symbol: __imp_FormatMessageW (first seen in libportaudio.a(pa_win_util.c.obj))
test_portaudio_static.lpr(30,1) Error: Undefined symbol: __imp_WideCharToMultiByte (first seen in libportaudio.a(pa_win_util.c.obj))
test_portaudio_static.lpr(30,1) Error: Undefined symbol: __imp_waveOutWrite (first seen in libportaudio.a(pa_win_wmme.c.obj))
test_portaudio_static.lpr(30,1) Error: Undefined symbol: __imp_waveOutGetErrorTextW (first seen in libportaudio.a(pa_win_wmme.c.obj))
test_portaudio_static.lpr(30,1) Error: Undefined symbol: __imp_waveInAddBuffer (first seen in libportaudio.a(pa_win_wmme.c.obj))
test_portaudio_static.lpr(30,1) Error: Undefined symbol: __imp_waveInGetErrorTextW (first seen in libportaudio.a(pa_win_wmme.c.obj))
test_portaudio_static.lpr(30,1) Error: Undefined symbol: __imp_SetEvent (first seen in libportaudio.a(pa_win_wmme.c.obj))
test_portaudio_static.lpr(30,1) Error: Undefined symbol: __imp_waveOutReset (first seen in libportaudio.a(pa_win_wmme.c.obj))
test_portaudio_static.lpr(30,1) Error: Undefined symbol: __imp_waveInReset (first seen in libportaudio.a(pa_win_wmme.c.obj))
test_portaudio_static.lpr(30,1) Error: Undefined symbol: __imp_WaitForSingleObject (first seen in libportaudio.a(pa_win_wmme.c.obj))
test_portaudio_static.lpr(30,1) Error: Undefined symbol: __imp_CloseHandle (first seen in libportaudio.a(pa_win_wmme.c.obj))
test_portaudio_static.lpr(30,1) Error: Undefined symbol: __imp_waveOutOpen (first seen in libportaudio.a(pa_win_wmme.c.obj))
test_portaudio_static.lpr(30,1) Error: Undefined symbol: __imp_waveInOpen (first seen in libportaudio.a(pa_win_wmme.c.obj))
test_portaudio_static.lpr(30,1) Error: Undefined symbol: __imp_waveOutUnprepareHeader (first seen in libportaudio.a(pa_win_wmme.c.obj))
test_portaudio_static.lpr(30,1) Error: Undefined symbol: __imp_waveInUnprepareHeader (first seen in libportaudio.a(pa_win_wmme.c.obj))
test_portaudio_static.lpr(30,1) Error: Undefined symbol: __imp_waveInPrepareHeader (first seen in libportaudio.a(pa_win_wmme.c.obj))
test_portaudio_static.lpr(30,1) Error: Undefined symbol: __imp_waveOutPrepareHeader (first seen in libportaudio.a(pa_win_wmme.c.obj))
test_portaudio_static.lpr(30,1) Error: Undefined symbol: ___chkstk_ms (first seen in libportaudio.a(pa_win_wmme.c.obj))
test_portaudio_static.lpr(30,1) Error: Undefined symbol: __imp_waveOutClose (first seen in libportaudio.a(pa_win_wmme.c.obj))
test_portaudio_static.lpr(30,1) Error: Undefined symbol: __imp_waveInClose (first seen in libportaudio.a(pa_win_wmme.c.obj))
test_portaudio_static.lpr(30,1) Error: Undefined symbol: __imp_GetLastError (first seen in libportaudio.a(pa_win_wmme.c.obj))
test_portaudio_static.lpr(30,1) Error: Undefined symbol: __imp_CreateEventW (first seen in libportaudio.a(pa_win_wmme.c.obj))
test_portaudio_static.lpr(30,1) Error: Undefined symbol: __imp_waveOutPause (first seen in libportaudio.a(pa_win_wmme.c.obj))
test_portaudio_static.lpr(30,1) Error: Undefined symbol: __imp_ResetEvent (first seen in libportaudio.a(pa_win_wmme.c.obj))
test_portaudio_static.lpr(30,1) Error: Undefined symbol: __imp__beginthreadex (first seen in libportaudio.a(pa_win_wmme.c.obj))
test_portaudio_static.lpr(30,1) Error: Undefined symbol: __imp_SetThreadPriority (first seen in libportaudio.a(pa_win_wmme.c.obj))
test_portaudio_static.lpr(30,1) Error: Undefined symbol: __imp_waveInStart (first seen in libportaudio.a(pa_win_wmme.c.obj))
test_portaudio_static.lpr(30,1) Error: Undefined symbol: __imp_waveOutRestart (first seen in libportaudio.a(pa_win_wmme.c.obj))
test_portaudio_static.lpr(30,1) Error: Undefined symbol: __imp_WaitForMultipleObjects (first seen in libportaudio.a(pa_win_wmme.c.obj))
test_portaudio_static.lpr(30,1) Error: Undefined symbol: __imp_waveOutGetPosition (first seen in libportaudio.a(pa_win_wmme.c.obj))
test_portaudio_static.lpr(30,1) Error: Undefined symbol: __imp_waveInMessage (first seen in libportaudio.a(pa_win_wmme.c.obj))
test_portaudio_static.lpr(30,1) Error: Undefined symbol: __imp_waveOutMessage (first seen in libportaudio.a(pa_win_wmme.c.obj))
test_portaudio_static.lpr(30,1) Error: Undefined symbol: __imp_waveInGetNumDevs (first seen in libportaudio.a(pa_win_wmme.c.obj))
test_portaudio_static.lpr(30,1) Error: Undefined symbol: __imp_waveOutGetNumDevs (first seen in libportaudio.a(pa_win_wmme.c.obj))
test_portaudio_static.lpr(30,1) Error: Undefined symbol: __imp_waveInGetDevCapsW (first seen in libportaudio.a(pa_win_wmme.c.obj))
test_portaudio_static.lpr(30,1) Error: Undefined symbol: __imp_waveOutGetDevCapsW (first seen in libportaudio.a(pa_win_wmme.c.obj))
test_portaudio_static.lpr(30,1) Error: Undefined symbol: __imp_GetEnvironmentVariableA (first seen in libportaudio.a(pa_win_wmme.c.obj))
test_portaudio_static.lpr(30,1) Error: Undefined symbol: memcpy (first seen in libportaudio.a(pa_win_wmme.c.obj))
test_portaudio_static.lpr(30,1) Error: Undefined symbol: memset (first seen in libportaudio.a(pa_win_wmme.c.obj))
test_portaudio_static.lpr(30,1) Error: Undefined symbol: atoi (first seen in libportaudio.a(pa_win_wmme.c.obj))
test_portaudio_static.lpr(30,1) Error: Undefined symbol: strlen (first seen in libportaudio.a(pa_win_wmme.c.obj))
test_portaudio_static.lpr(30,1) Error: Undefined symbol: __imp_timeEndPeriod (first seen in libportaudio.a(pa_win_ds.c.obj))
test_portaudio_static.lpr(30,1) Error: Undefined symbol: __imp_SetWaitableTimer (first seen in libportaudio.a(pa_win_ds.c.obj))
test_portaudio_static.lpr(30,1) Fatal: There were 50 errors compiling module, stopping
Fatal: Compilation aborted
Error: C:\fpcupdeluxe\fpc\bin\x86_64-win64\ppcx64.exe returned an error exitcode"

with LinkLib, I execute build.bat but no detail:

{$IFDEF MSWINDOWS}
  // PortAudio statique
  {$LINKLIB libportaudio.a}

  // C++ for ASIO
  {$LINKLIB libstdc++.a}
  {$LINKLIB libsupc++.a}
  {$LINKLIB libgcc_eh.a}
  {$LINKLIB libgcc.a}

  // Threads MinGW
  {$LINKLIB libwinpthread.a}

  // Runtime C MinGW
  {$LINKLIB libmingw32.a}
  {$LINKLIB libmingwex.a}
  {$LINKLIB libmoldname.a}
  {$LINKLIB libmsvcrt.a}

  // Windows
  {$LINKLIB winmm}
  {$LINKLIB ole32}
  {$LINKLIB oleaut32}
  {$LINKLIB uuid}
  {$LINKLIB setupapi}
  {$LINKLIB advapi32}
  {$LINKLIB avrt}
  {$LINKLIB kernel32}
  {$LINKLIB user32}
{$ENDIF}

"
Free Pascal Compiler version 3.3.1-20107-g8594e9ad47-dirty [2026/04/28] for x86_64
Copyright (c) 1993-2026 by Florian Klaempfl and others
Target OS: Win64 for x64
Compiling test_portaudio_static.lpr
Compiling uportaudiostatic.pas
Linking test_portaudio_static.exe
Error: C:\fpcupdeluxe\fpc\bin\x86_64-win64\ppcx64.exe returned an error exitcode"
« Last Edit: May 20, 2026, 02:29:22 pm by bbrx »

Fred vS

  • Hero Member
  • *****
  • Posts: 3946
    • StrumPract is the musicians best friend

Thanks Fred for the detail, I see 2 folders on archive "libportaudio-static-windows" and "windows-static" with 2 differents file size?


In https://github.com/fredvs/portaudio-static/releases/tag/1 there is windows-static.zip and  linux-static.zip  .
Download  windows-static.zip and unzip it to get libportaudio-static-win64.a and libportaudio-static-win32.a

Use this files (depend on win32 or win64 of your project), if you prefer rename it as libportaudio.a.

For how to use it on fpc windows, maybe you will need to static link other libs, I did not try.
I use Lazarus 2.2.0 32/64 and FPC 3.2.2 32/64 on Debian 11 64 bit, Windows 10, Windows 7 32/64, Windows XP 32,  FreeBSD 64.
Widgetset: fpGUI, MSEgui, Win32, GTK2, Qt.

https://github.com/fredvs
https://gitlab.com/fredvs
https://codeberg.org/fredvs

bbrx

  • New Member
  • *
  • Posts: 26

Thanks Fred for the detail, I see 2 folders on archive "libportaudio-static-windows" and "windows-static" with 2 differents file size?


In https://github.com/fredvs/portaudio-static/releases/tag/1 there is windows-static.zip and  linux-static.zip  .
Download  windows-static.zip and unzip it to get libportaudio-static-win64.a and libportaudio-static-win32.a

Use this files (depend on win32 or win64 of your project), if you prefer rename it as libportaudio.a.

For how to use it on fpc windows, maybe you will need to static link other libs, I did not try.

I did it , I tried with libportaudio-win64.a (I renamed) with LINKLIB, error but no detail :

Free Pascal Compiler version 3.3.1-20107-g8594e9ad47-dirty [2026/04/28] for x86_64
Copyright (c) 1993-2026 by Florian Klaempfl and others
Target OS: Win64 for x64
Compiling test_portaudio_static.lpr
Compiling uportaudiostatic.pas
Linking test_portaudio_static.exe
Error: C:\fpcupdeluxe\fpc\bin\x86_64-win64\ppcx64.exe returned an error exitcode"

Just to know which FPC version did you used?

Fred vS

  • Hero Member
  • *****
  • Posts: 3946
    • StrumPract is the musicians best friend

Thanks Fred for the detail, I see 2 folders on archive "libportaudio-static-windows" and "windows-static" with 2 differents file size?


Ooops, yes I see now, 2 folders are in the zip, I will update it, only /libportaudio-static-windows is ok.
I use Lazarus 2.2.0 32/64 and FPC 3.2.2 32/64 on Debian 11 64 bit, Windows 10, Windows 7 32/64, Windows XP 32,  FreeBSD 64.
Widgetset: fpGUI, MSEgui, Win32, GTK2, Qt.

https://github.com/fredvs
https://gitlab.com/fredvs
https://codeberg.org/fredvs

Fred vS

  • Hero Member
  • *****
  • Posts: 3946
    • StrumPract is the musicians best friend

Thanks Fred for the detail, I see 2 folders on archive "libportaudio-static-windows" and "windows-static" with 2 differents file size?


In https://github.com/fredvs/portaudio-static/releases/tag/1 there is windows-static.zip and  linux-static.zip  .
Download  windows-static.zip and unzip it to get libportaudio-static-win64.a and libportaudio-static-win32.a

Use this files (depend on win32 or win64 of your project), if you prefer rename it as libportaudio.a.

For how to use it on fpc windows, maybe you will need to static link other libs, I did not try.

I did it , I tried with libportaudio-win64.a (I renamed) with LINKLIB, error but no detail :

Free Pascal Compiler version 3.3.1-20107-g8594e9ad47-dirty [2026/04/28] for x86_64
Copyright (c) 1993-2026 by Florian Klaempfl and others
Target OS: Win64 for x64
Compiling test_portaudio_static.lpr
Compiling uportaudiostatic.pas
Linking test_portaudio_static.exe
Error: C:\fpcupdeluxe\fpc\bin\x86_64-win64\ppcx64.exe returned an error exitcode"

Just to know which FPC version did you used?

Like I said, I only tried on linux, with fpc 3.2.2.
I use Lazarus 2.2.0 32/64 and FPC 3.2.2 32/64 on Debian 11 64 bit, Windows 10, Windows 7 32/64, Windows XP 32,  FreeBSD 64.
Widgetset: fpGUI, MSEgui, Win32, GTK2, Qt.

https://github.com/fredvs
https://gitlab.com/fredvs
https://codeberg.org/fredvs

 

TinyPortal © 2005-2018