Cobra Forum

Linux Specialised Support => Wine => Topic started by: kalpana on Oct 28, 2023, 04:59 AM

Title: native shared library crashes if C++ exceptions are used on Ubuntu Wine build
Post by: kalpana on Oct 28, 2023, 04:59 AM
This problem appears only on Ubuntu 20.04 with Wine 5.0 installed from Ubuntu repository. If I build Wine 5.0 myself or install Wine 4.0.4 from Wine repository, then there is no problem, so I assume the problem is in Ubuntu 20.04 build of Wine.

I have written a shared library for our application using Winelib project, which calls native Linux API. C++ is used. Crash happens on first C++ exception thrown.
App which shows the problem:

Code:

#include <stdexcept>
#include <stdio.h>

int main() {
    printf("start\n");
    try {
        throw std::runtime_error("desc");
    } catch (std::exception &ex) {
        printf("in catch\n");
    }
    printf("end\n");
}

built with:
Code:
    g++ -c -fPIC t.cpp
    /home/mkk/wine-git_64/tools/winegcc/wineg++ -B/home/mkk/wine-git_64/tools/winebuild -o tt t.o

run as:
Code:
   wine tt.exe.so
Prints 'start', then crashes.
Any idea how to solve this problem?