Code::Blocks Forums
User forums => Help => Topic started by: Michaela Joy on March 01, 2015, 10:15:21 pm
-
Hi,
I would like to build a C dll for Windows using tdm-gcc w64 and code::blocks. However, when I create a new project using the wizard, there is no option to specify whether the DLL is C or C++.
So, I get a C++ dll project ever time. I went looking around in the various settings and have not found any way to change this (tdm-gcc g++ is used as the compiler)
I'm using code::blocks 13.12
Thanks in advance,
:MJ
-
Not tested.
1. Save the generated C++ file with an file extension of ".c".
2. Add the saved file to the project.
3. Remove the C++ file from the project.
Then build the project.
Tim S.
-
@stahta01: Thanks for replying.
As you suggested, I created a new DLL project called test, and added a new C source file to it, following your instructions.
It used gcc to compile, but it uses g++ to link.
To be honest, I don't know enough about the toolset to know whether or not this will make a difference in the DLL.
I'm going to build a more complex test and see.
:MJ
-
It used gcc to compile, but it uses g++ to link.
I have no idea if linking with g++ will or will NOT cause an issue.
To make it link using gcc instead of g++ you have two simple options.
1. Edit the GCC toolchain setting by changing the command used to link. (this means you can no longer compile C++ code using this compiler)
2. Copy the GCC toolchain and then edit the new compiler settings.
(Remember to change the CB project to using the new toolchain/compiler)
Tim S.