Code::Blocks Forums

User forums => Using Code::Blocks => Topic started by: sean on April 14, 2008, 06:26:31 pm

Title: How to configure C::B to use DEF file when creating DLL?
Post by: sean on April 14, 2008, 06:26:31 pm
I am a newbie with C::B.  I am using Visual c++6.0 compiler. I am trying to build a DLL project and it seems that C::B doesn't recognize the DEF file.

Is there a way to configure C::B to pick up the DEF file?

Thanks so much!!
Title: Re: How to configure C::B to use DEF file when creating DLL?
Post by: morning on July 07, 2008, 03:53:32 am
you may add the followning flags to linker flags
 /def:"yourfilename.def"

in vc/vs,m$ do this job for you automatically ,it will insert this flag when invoke linker,but you need you do this manual in code::blocks.
Title: Re: How to configure C::B to use DEF file when creating DLL?
Post by: adimsh on July 08, 2008, 04:51:02 pm
you may add the followning flags to linker flags
 /def:"yourfilename.def"

in vc/vs,m$ do this job for you automatically ,it will insert this flag when invoke linker,but you need you do this manual in code::blocks.

Hi, thnaks for the tip, but did not work with me,

I choose from "Project"-> Build Options -> Linker Settings tab ->  Other linker options box, and add

/def:"yourfilename.def"

I get file not found error, I added an absolute path, "c:\yourfilename.def", and I get the error
Code
mingw32-g++.exe: /def:c:\yourfilename.def: Invalid argument
I have the following in the def file:
Code
LIBRARY MT_TestDll

EXPORTS
MyMsg

then I tried keep the def file inside my project main path, and added the absolute path of my project to Linker Search Directories in build options, and use the form: /def:"yourfilename.def" in liker options, the build was completed successfully but no ".DLL" file is generated, only a ".a" file.


Would you please tell me what I did wrong?

Regards,
Title: Re: How to configure C::B to use DEF file when creating DLL?
Post by: keyser on July 09, 2008, 12:05:10 pm
you may add the followning flags to linker flags
 /def:"yourfilename.def"

in vc/vs,m$ do this job for you automatically ,it will insert this flag when invoke linker,but you need you do this manual in code::blocks.

Hi, thnaks for the tip, but did not work with me,

I choose from "Project"-> Build Options -> Linker Settings tab ->  Other linker options box, and add

/def:"yourfilename.def"

I get file not found error, I added an absolute path, "c:\yourfilename.def", and I get the error
Code
mingw32-g++.exe: /def:c:\yourfilename.def: Invalid argument
I have the following in the def file:
Code
LIBRARY MT_TestDll

EXPORTS
MyMsg

then I tried keep the def file inside my project main path, and added the absolute path of my project to Linker Search Directories in build options, and use the form: /def:"yourfilename.def" in liker options, the build was completed successfully but no ".DLL" file is generated, only a ".a" file.


Would you please tell me what I did wrong?

Regards,

i am using MinGW packed with Code::Blocks. I found a way to use DEF file.

in Project => Build Option... => Linker settings , add the .DEF file to your project's link libraries , and then build the project, you will got what you need.
Title: Re: How to configure C::B to use DEF file when creating DLL?
Post by: shen_li_li on August 15, 2008, 03:08:35 am
-Wl,--kill-at  --def=test.def