Building dll's with Bakefile Topic is solved

Do you have a question about makefiles, a compiler or IDE you are using and need to know how to set it up for wxWidgets or why it doesn't compile but other IDE's do ? Post your questions here.
Post Reply
sethjackson
Super wx Problem Solver
Super wx Problem Solver
Posts: 396
Joined: Wed Oct 05, 2005 1:19 am

Building dll's with Bakefile

Post by sethjackson » Sat Mar 01, 2008 2:44 am

Hey I recently started using Bakefile as my build system, and so far it works well.

However, I ran into a problem trying to build dll's with it.
For some reason import libraries aren't generated, even though the linker is told to make them. :?

So now my executable fails to build because the import library can't be found.

Does anyone know how to fix this?
Maybe I need to set some option in my Bakefile?


I'm using Bakefile 0.2.3, with MSVC 9, on Windows Vista.

Thanks!
Last edited by sethjackson on Mon Mar 03, 2008 7:00 pm, edited 2 times in total.

tan
Moderator
Moderator
Posts: 1471
Joined: Tue Nov 14, 2006 7:58 am
Location: Saint-Petersburg, Russia

Re: Building dll's with Bakefile

Post by tan » Sat Mar 01, 2008 6:54 am

Hi,
sethjackson wrote:Hey I recently started using Bakefile as my build system, and so far it works well.

However, I ran into a problem trying to build dll's with it.
For some reason import libraries aren't generated, even though the linker is told to make them. :?
do you mean the dlls were built successfully but without import libs?
I know just one reason for that. You don't have anything to export from it :)
Try run dumpbin utility with switch /EXPORTS.
Here is a sample:

Code: Select all

dumpbin /EXPORTS wxChartDll.dll

Microsoft (R) COFF/PE Dumper Version 7.10.3077
Copyright (C) Microsoft Corporation.  All rights reserved.


Dump of file wxChartDll.dll

File Type: DLL

  Section contains the following exports for wxChartDll.dll

    00000000 characteristics
    47963840 time date stamp Tue Jan 22 21:38:56 2008
        0.00 version
           1 ordinal base
         877 number of functions
         877 number of names

    ordinal hint RVA      name
         
          1    0 00012AB0 [email protected]@[email protected]@@Z
          2    1 00012990 [email protected]@[email protected]@Z
          3    2 00012A20 [email protected]@[email protected]@Z
          4    3 000146B0 [email protected]@[email protected]@@Z
          5    4 00014670 [email protected]@[email protected]@Z
          6    5 00023D30 [email protected]@[email protected]@@Z

Can you see any exported symbols?

To export any symbol from dll (for MSVC) you have to use __declspec(dllexport) attribute:
http://msdn2.microsoft.com/en-us/librar ... S.80).aspx
OS: Windows XP Pro
Compiler: MSVC++ 7.1
wxWidgets: 2.8.10

sethjackson
Super wx Problem Solver
Super wx Problem Solver
Posts: 396
Joined: Wed Oct 05, 2005 1:19 am

Post by sethjackson » Sat Mar 01, 2008 9:49 pm

Yeah I don't get anything with dumpbin.

So I have to write __declspec( dllexport )?

Yuck (and non-portable)!

Anyway to use DLL's with MSVC 9 without this (maybe without import libs)?

I really don't want to use static libs....
I never had to do anything like this with GCC (MinGW).
So what gives?
Last edited by sethjackson on Mon Mar 03, 2008 7:00 pm, edited 1 time in total.

tan
Moderator
Moderator
Posts: 1471
Joined: Tue Nov 14, 2006 7:58 am
Location: Saint-Petersburg, Russia

Post by tan » Sun Mar 02, 2008 7:43 am

sethjackson wrote:Yeah I don't get anything with dumpbin.

So I have to write __declspec( dllexport )?

Yuck (and non-portable)!
You have to use #ifdefined statement :)
Have a look into file WX_ROOT/include/wx/dlimpexp.h for examples.
sethjackson wrote: Anyway to use DLL's with MSVC 8 without this (maybe without import libs)?
There is another way :) That is module-definition (.def) files:
http://msdn2.microsoft.com/en-us/librar ... s.71).aspx
OS: Windows XP Pro
Compiler: MSVC++ 7.1
wxWidgets: 2.8.10

sethjackson
Super wx Problem Solver
Super wx Problem Solver
Posts: 396
Joined: Wed Oct 05, 2005 1:19 am

Post by sethjackson » Mon Mar 03, 2008 7:03 pm

Ok. I guess there is no way to just tell the compiler to export everything (export for you) without writing __declspec?

BTW I should have said I was using MSVC 9 not 8... Sorry. :oops:

tan
Moderator
Moderator
Posts: 1471
Joined: Tue Nov 14, 2006 7:58 am
Location: Saint-Petersburg, Russia

Post by tan » Mon Mar 03, 2008 8:41 pm

sethjackson wrote:Ok. I guess there is no way to just tell the compiler to export everything (export for you) without writing __declspec?
You are right, there isn't. BTW, wx itself heavy uses it so that is "native" way for wx users :)
You can use special wx macros (defined in dlimpexp.h) WXIMPORT and WXEXPORT (and many others), with them you don't need widely use #ifdef blabla... in your code.
OS: Windows XP Pro
Compiler: MSVC++ 7.1
wxWidgets: 2.8.10

sethjackson
Super wx Problem Solver
Super wx Problem Solver
Posts: 396
Joined: Wed Oct 05, 2005 1:19 am

Post by sethjackson » Tue Mar 04, 2008 6:18 pm

Ok. Thanks!

Post Reply