On 22.05.2011 20:19, Albrecht Schlosser wrote:
> On 22.05.2011 19:37, Nikita Egorov wrote:
>
>> I just tried to build one of tests with dll and all worked fine. ( RC5 )
>> But you need change the program settings: fltk.lib -> fltkdll.lib and
>> add one more libraries path ..\..\test.
>
> Yes, I did this as well yesterday for another test (I used the device
> demo), and it worked as you wrote (I believe that I replaced the
> library path instead of adding another path).
>
> As you say, it worked - surprisingly without adding a WinMain()
> function. I wonder why and how this worked, though...
>
> Then I also created a new project from scratch that linked with
> fltkdll, and in this project I got the undefined reference WinMain(),
> as expected. I solved it by adding a small winmain.c file, and this
> worked.

Now I modified my test project, removed my winmain.c file and got the
undefined references again. Then I added fltk.lib (the static library)
after fltkdll.lib, and I had to add the search path, as written by
Nikita. With this change I could link successfully. The resulting
.exe file has only 59 KB and depends on fltkdll.dll, i.e. I got the
WinMain() function from fltk.lib.

This means: you can link with the dll (fltkdll.lib/.dll) and also
add fltk.lib (the static library) *after* the .dll (or maybe order
doesn't matter at all), and the linker will pick WinMain() from the
static library. :-)

Looking at the linker commandline of the FLTK project's device demo
program that I modified to use *only* fltkdll (and not the static
library) shows that fltk.lib (the static library) is used anyway.
There is a fixed dependency on fltk.lib that I can't remove, and
this explains why this worked.

Albrecht
_______________________________________________
fltk mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk

Reply via email to