On Wed, Jun 10, 2020 at 11:34 AM Yaakov Selkowitz <yselkowi@redhat.com> wrote:
On Wed, 2020-06-10 at 10:26 -0500, Richard Shaw wrote:
> I'm working on the ability to produce Windows builds of fldigi using
> the Fedora MinGW stack.
>
> Currently the 32bit builds compile with little to no warnings and
> appear to function properly, however, on 64bit builds there is a ton
> more warnings (I have to use -fpermissive) and the program segfaults
> shortly after launching.
>
> I have tried to capture a gdb stack trace but it produces no results... zero.

The most common cause of this is work-size incorrectness, e.g. misuse
of LONG vs long, deprecated use of DWORD vs DWORD_PTR, etc. in variable
types being passed to (or returned from) Win32 APIs.  Those warnings
might be indicative of such issues.

Ok, I'm grepping through the sources and do see DWORD used quite a bit but not in the areas giving me trouble...

 
> For instance:
> dialogs/fl_digi.cxx: In function 'void cb_mnuVisitURL(Fl_Widget*, void*)':
> dialogs/fl_digi.cxx:2616:68: error: cast from 'HINSTANCE' {aka 'HINSTANCE__*'} to 'int' loses precision [-fpermissive]
>  2616 |  if ((int)ShellExecute(NULL, "open", url, NULL, NULL, SW_SHOWNORMAL) <= 32)
>       |                                                                    ^

HINSTANCE is a pointer, so that's to be expected.  Even though the docs
say to cast to int, INT_PTR might be a safer choice here.

That worked (at least for compiling), I still need to get through other problems before I can test the resultant package.

Now seeing a few similar to this:

 rigcontrol/FreqControl.cxx: In function 'void cbSelectDigit(Fl_Widget*, void*)':
rigcontrol/FreqControl.cxx:63:49: error: cast from 'void*' to 'long int' loses precision [-fpermissive]
   63 |  int Nbr = (INT_PTR)(reinterpret_cast<long> (nbr));

Thanks,
Richard