I can't give a good answer yet as to why yours is failing, but I can at least provide an example of one that works for me.
I"m using GCC/GNAT 14.2 to compile in msys2 on Windows 11. I don't know a good example of C using posix threads, but I know that std::thread in c++ uses pthread in my implementation, so I'll use that. First the C++ file:
cfile.cpp
#include <thread>
#include <iostream>
void threadTest(){}
using namespace std;
extern "C" {
void do_something(){
thread t(threadTest);
cout << "Started Thread" << endl;
t.join();
cout << "Finished Thread" << endl;
}
}
I compiled it using the command:
g++ -c cfile.cpp
which generates cfile.o
Next I make a test Ada file:
main.adb
with Ada.Text_IO; use Ada.Text_IO;
procedure Main is
procedure Do_Something
with Import, Convention => C, External_Name => "do_something";
begin
Put_Line("Hello World");
Do_Something;
end;
Finally I compile it with:
gnatmake main.adb -largs cfile.o -lstdc++ -lpthread
Which compiles without error and generates the file main.exe (on linux distros it might just be "main" without an extension). My test folder has the following files:
cfile.cpp cfile.o main.adb main.ali main.exe main.o
Running the main.exe gives:
Hello World
Started Thread
Finished Thread
So my first guess is that it is generating the file, but lack of file extension might be throwing you off. Otherwise, perhaps there is a library you are missing and for whatever reason the compiler is bugging and not giving the output (or stderr is redirected somewhere??).
See if my example works for you and if so, maybe we can work backwords to figure out why yours is not working.