Author Topic: Adding a compiler  (Read 10795 times)

Offline colinmac

  • Multiple posting newcomer
  • *
  • Posts: 10
Adding a compiler
« on: November 21, 2008, 12:47:00 pm »
Hi.

I'd like to add a new compiler to the standard list.  Is the best way to modify the existing compilers.dll or to create a new plugin?

(Actually I tried creating a new plugin using the current 8.02 edition and it doesn't create a .cbplugin file, just a .dll.  I saw a reference to that being the old way, so I'm a bit confused as to how I would do the new version.  Is the nightly build massively far ahead of 8.02?)

Colin

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9699
Re: Adding a compiler
« Reply #1 on: November 21, 2008, 01:27:48 pm »
Is the best way to modify the existing compilers.dll
I'm afraid this is the way.

using the current 8.02 edition and it doesn't create a .cbplugin file, just a .dll.
The *.cbplugin file is nothing else than a *.zip archive including the DLL, all resources required (at least the plugin's manifest file, probably images and e.g. XRC resources) and renamed to *.cbplugin. So you can easily create it yourself. Look at the project file(s) of other plugins how they manage to have the *.cbplugin created as post-process after compiling.
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: https://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: https://wiki.codeblocks.org/index.php?title=FAQ

Offline colinmac

  • Multiple posting newcomer
  • *
  • Posts: 10
Re: Adding a compiler
« Reply #2 on: November 21, 2008, 03:04:52 pm »
Ok, thanks.

It shouldn't be a big deal to modify compilers.dll, and I've added a new class using the tried & true 'copy something that already works and change the name' principle.  This builds OK, but the resulting DLL doesn't work, because Code::Blocks can't load it.  I get the standard 'One of more plugins were not loaded' message.

The build environment should be fine, which is to say that I can build a simple console Hello World using MinGW.  A hex dump of my compilers.dll and the original shows that the headers are broadly similar, so it doesn't look like I'm building for the wrong target or anything like that.  Is there some common mistake or other that people tend to make in these circumstances?  I'm kind of stuck because I can't see any clue as to why compilers.dll can't be loaded.

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9699
Re: Adding a compiler
« Reply #3 on: November 21, 2008, 03:51:07 pm »
Is there some common mistake or other that people tend to make in these circumstances?
A common misake is that you use the current SDK (headers etc. from SVN) but use it e.g. with 08/02. This wont work as it's not API compatible.

Did you compile the *whole* C::B yourself, use the SDK created thereby for the compiler plugin and use this C::B version at runtime?

Another issue might be that you forgot to run the update script if you compile C::B from scratch yourself.
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: https://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: https://wiki.codeblocks.org/index.php?title=FAQ

Offline colinmac

  • Multiple posting newcomer
  • *
  • Posts: 10
Re: Adding a compiler
« Reply #4 on: November 21, 2008, 03:57:18 pm »
I'm using the 8.02 source package (codeblocks-8.02-src.tar.bz2) downloaded from the website, and haven't taken anything from SVN.  I'm assuming the sources in the package were used to build the binary in the package?

I didn't compile the whole of C::B; I figured it should be enough just to build the compilers DLL.

Offline dmoore

  • Developer
  • Lives here!
  • *****
  • Posts: 1576
Re: Adding a compiler
« Reply #5 on: November 21, 2008, 05:09:25 pm »
if you are using cb provided binaries and headers, then you also need to link against the cb provided wxwidgets dll.

Offline dmoore

  • Developer
  • Lives here!
  • *****
  • Posts: 1576
Re: Adding a compiler
« Reply #6 on: November 21, 2008, 05:21:19 pm »
you should compile your own cb from the latest svn though if you plan to submit patches.