Allegro.cc - Online Community

Allegro.cc Forums » Programming Questions » Creating wrapper library (DLL)

This thread is locked; no one can reply to it. rss feed Print
Creating wrapper library (DLL)
Undecember
Member #23,807
August 2023

Hi. I'm building a game with Allegro5, and I have a problem.
I tried to separate some specific features in a wrapper DLL.

And I got
LNK2001 : unresolved external symbol main
and I found that this error occurs just if I include <allegro/allegro5.h>.

For test, I created an empty VS2022 DLL project, without changing anything except adding #include <allegro/allegro5.h> and I got the same error.
How can I properly create a wrapper DLL of allegro5?

My environment is Win11x64 and VS2022.

Edgar Reynaldo
Major Reynaldo
May 2007
avatar

If you create a dynamic library (dll) that depends on allegro, you have to link allegro to it. Since you're making a dll, it should have a dllmain, created automatically by VS. If you want to make a static library, you don't have to link to allegro now, but you will when you link your library to your program later.

I don't get any error about missing main when making a dll that depends on allegro but then I'm on MinGW-W64.

torhu
Member #2,727
September 2002
avatar

Search for mainCRTStartup in the Allegro source, you might need to add a #define to disable that pragma when creating a DLL.

Go to: