1
votes

i'am using GNAT GPS 2012. And due some libraries i must use '-mwindows' option to succesfully link my program (it is actually mixed Ada/C++).

The program works fine in 2 cases: 1) if launch it via GNAT launcher (i mean the triangle button placed on the top of toolbar) - all is ok in that case 2) if launch ".exe" separately from windows cmd or explorer and DO NOT OUTPUT ANY TEXT from the Ada side.

But(!) if launch program separately from the windows cmd or explorer than: 1) call Put or Put_Line function -> the program immediately finish (no errors, no exceptions, just exit) 2) if call printf from C++ side it will be ignored

I have established in the separate mixed Ada/C++ simple sample that this problem arises when '-mwindows' linker option is added to the Ada linker.

I have also tried to copy dlls from GNAT project to exe folder but it didn't help.

Could you please help me, guys? Thanks!

2

2 Answers

2
votes

According to the FSF GNAT User Manual, -mwindows means there is no console; so where would the Put_Line or printf output go? My guess would be that the Ada call raises an exception, which (silently) ends the program, while the C call effectively does nothing.

If I'm right, though, I have no explanation for the behaviour within GPS.

2
votes

This could be due to a failure to start-up the Ada RTL.

I think the operation you want is adainit().