Linking with gcc-produced code lazarus / 34-Windows ---------------------------------------------------------------------- Kurt · 2016-11-26 03:08 I am trying to link against a library that was statically compiled on Windows with gcc under mingw.  All the symbols in the library itself resolve just fine.  However all the Windows API calls made by the code in the library come back with undefined symbols.  From what I can tell, gcc is "doing the right thing"™ and mangling the identifiers in the correct STDCALL way.  ie: _CreateFileMappingA@24 Is there a way to get the linker to recognize those and link them against the proper Windows API call? ---------------------------------------------------------------------- Phil · 2016-11-26 04:01 Quote from: Kurt on November 26, 2016, 04:08:55 amIs there a way to get the linker to recognize those and link them against the proper Windows API call? I'm not entirely sure if understand what you're doing, but try these switches with gcc (or Clang): -Wl,--enable-stdcall-fixup https://macpgmr.github.io/MacXPlatform/PascalDynLibs.html ---------------------------------------------------------------------- skalogryz · 2016-11-26 04:12 The library itself is using winAPI, that's why it's looking for "_CreateFileMappingA@24" (the odd looking name is a stdcall convention) The issue should be resolved by linking to libkernel32.a. Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i {$linklib libkernel32.a} The library should come with Mingw. You would need to either copy it to your project folder or specify the location in the search path. ---------------------------------------------------------------------- Kurt · 2016-11-27 13:42 Lazarus uses WinAPI too, and has no problem linking against symbols in kernel32.dll without an external MinGW library.  Does FreePascal's internal linker not support stdcall decorations?