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!
Building dll's with Bakefile Topic is solved
-
- Super wx Problem Solver
- Posts: 396
- Joined: Wed Oct 05, 2005 1:19 am
Building dll's with Bakefile
Last edited by sethjackson on Mon Mar 03, 2008 7:00 pm, edited 2 times in total.
-
- wxWorld Domination!
- Posts: 1471
- Joined: Tue Nov 14, 2006 7:58 am
- Location: Saint-Petersburg, Russia
Re: Building dll's with Bakefile
Hi,
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:
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
do you mean the dlls were built successfully but without import libs?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.
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 ??0vData@@QAE@ABV0@@Z
2 1 00012990 ??0vData@@QAE@NNPBNII@Z
3 2 00012A20 ??0vData@@QAE@PBN0II@Z
4 3 000146B0 ??0vDataArg@@QAE@ABV0@@Z
5 4 00014670 ??0vDataArg@@QAE@II@Z
6 5 00023D30 ??0vDataArgX0DX@@QAE@ABV0@@Z
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
Compiler: MSVC++ 7.1
wxWidgets: 2.8.10
-
- Super wx Problem Solver
- Posts: 396
- Joined: Wed Oct 05, 2005 1:19 am
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?
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.
-
- wxWorld Domination!
- Posts: 1471
- Joined: Tue Nov 14, 2006 7:58 am
- Location: Saint-Petersburg, Russia
You have to use #ifdefined statementsethjackson wrote:Yeah I don't get anything with dumpbin.
So I have to write __declspec( dllexport )?
Yuck (and non-portable)!
Have a look into file WX_ROOT/include/wx/dlimpexp.h for examples.
There is another way That is module-definition (.def) files:sethjackson wrote: Anyway to use DLL's with MSVC 8 without this (maybe without import libs)?
http://msdn2.microsoft.com/en-us/librar ... s.71).aspx
OS: Windows XP Pro
Compiler: MSVC++ 7.1
wxWidgets: 2.8.10
Compiler: MSVC++ 7.1
wxWidgets: 2.8.10
-
- Super wx Problem Solver
- Posts: 396
- Joined: Wed Oct 05, 2005 1:19 am
-
- wxWorld Domination!
- Posts: 1471
- Joined: Tue Nov 14, 2006 7:58 am
- Location: Saint-Petersburg, Russia
You are right, there isn't. BTW, wx itself heavy uses it so that is "native" way for wx userssethjackson wrote:Ok. I guess there is no way to just tell the compiler to export everything (export for you) without writing __declspec?
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
Compiler: MSVC++ 7.1
wxWidgets: 2.8.10