@Bastien

I build with MinGW on Qt Creator. And when I use DLL, I've the error.

I didn't ask you that. I know that. That's why I asked you:

And when you build it in Visual Studio you are using the MinGW compiler, not the MSVC one, just like you show you are using from Qt Creator, right?

So I asked you what compiler you are using from Visual Studio, not Qt Creator.

Having to make a guess and assuming you use MinGW from Qt Creator but MSVC from VS, I imagine that is precisely the answer to your:

This code works fine in Visual Studio but not in QtCreator... Why ?