Page 1 of 1
Building dll's with Bakefile
Posted: Sat Mar 01, 2008 2:44 am
by sethjackson
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!
Re: Building dll's with Bakefile
Posted: Sat Mar 01, 2008 6:54 am
by tan
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 ??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
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
Posted: Sat Mar 01, 2008 9:49 pm
by sethjackson
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?
Posted: Sun Mar 02, 2008 7:43 am
by tan
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
Posted: Mon Mar 03, 2008 7:03 pm
by sethjackson
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.
Posted: Mon Mar 03, 2008 8:41 pm
by tan
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.
Posted: Tue Mar 04, 2008 6:18 pm
by sethjackson
Ok. Thanks!