NO

Author Topic: Compilation order  (Read 5524 times)

jev

  • Guest
Compilation order
« on: October 17, 2012, 12:23:33 PM »
I was hoping "update all dependencies" in the IDE's workspace manager would also find dependencies on libraries, but it doesn't or it doesn't work...

So, I got a workspace in the IDE that contains 2 projects. One project builds a DLL (and a static library that defines the DLL's interface of course) that is needed by the other project. Is it possible to configure the workspace so that the DLL is built first and the other project -which depends on it- is built later?

« Last Edit: October 17, 2012, 12:25:12 PM by jev »

Offline TimoVJL

  • Global Moderator
  • Member
  • *****
  • Posts: 2153
Re: Compilation order
« Reply #1 on: October 17, 2012, 01:11:11 PM »
Is it possible to configure the workspace so that the DLL is built first and the other project -which depends on it- is built later?
Project -> Workspace -> Project dependencies
May the source be with you

jev

  • Guest
Re: Compilation order
« Reply #2 on: October 17, 2012, 06:24:41 PM »
Ah yes, thanks. Don't know how I could have missed that.

Here's a strange one... one of the projects is called "libtest" and it should generate "libtest.exe". Sometimes (but not always) the linker thinks it must generate a library from this project, but the executable is updated too. How weird is that?

Code: [Select]
- - - - - - - - - - libtest.exe
Building main_test.obj.
Building libtest.exe.
Creating object: C:\Users\jev\Documents\Pelles C Projects\CB0005\libtest.exp
Creating library: C:\Users\jev\Documents\Pelles C Projects\CB0005\libtest.lib
Writing debug information
Compacting CodeView information
Done.

CommonTater

  • Guest
Re: Compilation order
« Reply #3 on: October 17, 2012, 06:33:51 PM »
Ah yes, thanks. Don't know how I could have missed that.

Here's a strange one... one of the projects is called "libtest" and it should generate "libtest.exe". Sometimes (but not always) the linker thinks it must generate a library from this project, but the executable is updated too. How weird is that?

Code: [Select]
- - - - - - - - - - libtest.exe
Building main_test.obj.
Building libtest.exe.
Creating object: C:\Users\jev\Documents\Pelles C Projects\CB0005\libtest.exp
Creating library: C:\Users\jev\Documents\Pelles C Projects\CB0005\libtest.lib
Writing debug information
Compacting CodeView information
Done.

Are your projects by chance all in the same folder? 
If they are they will be sharing one OUTPUT folder that could be part of the problem. 

If you use the Workspace Manager AddIn and re-create your projects with it this problem is overcome since each project gets it's own separate output folder.
 
Installation is easy... read the FAQ about AddIns for details.
 
« Last Edit: October 17, 2012, 06:36:55 PM by CommonTater »

Offline TimoVJL

  • Global Moderator
  • Member
  • *****
  • Posts: 2153
Re: Compilation order
« Reply #4 on: October 17, 2012, 07:18:21 PM »
Ah yes, thanks. Don't know how I could have missed that.

Here's a strange one... one of the projects is called "libtest" and it should generate "libtest.exe". Sometimes (but not always) the linker thinks it must generate a library from this project, but the executable is updated too. How weird is that?

Code: [Select]
- - - - - - - - - - libtest.exe
Building main_test.obj.
Building libtest.exe.
Creating object: C:\Users\jev\Documents\Pelles C Projects\CB0005\libtest.exp
Creating library: C:\Users\jev\Documents\Pelles C Projects\CB0005\libtest.lib
Writing debug information
Compacting CodeView information
Done.
Is it possible that libtest.exe have exported functions ?
May the source be with you

jev

  • Guest
Re: Compilation order
« Reply #5 on: October 23, 2012, 12:07:56 PM »
Are your projects by chance all in the same folder? 
If they are they will be sharing one OUTPUT folder that could be part of the problem. 
Yes, they share the same output folder. Still, the names are not the same, there should really be no problem there. Will take a look at the workspace manager addin but still it smells buggy.

Is it possible that libtest.exe have exported functions ?
Nope.

Are you suggesting the tools do some guesswork on how to build things based on the contents of the sources? That would be very strange IMHO.

« Last Edit: October 23, 2012, 12:10:12 PM by jev »

CommonTater

  • Guest
Re: Compilation order
« Reply #6 on: October 23, 2012, 02:20:40 PM »
Are your projects by chance all in the same folder? 
If they are they will be sharing one OUTPUT folder that could be part of the problem. 
Yes, they share the same output folder. Still, the names are not the same, there should really be no problem there. Will take a look at the workspace manager addin but still it smells buggy.

Ummm... "Smells buggy"?  In what way?
« Last Edit: October 23, 2012, 03:06:59 PM by CommonTater »

CommonTater

  • Guest
Re: Compilation order
« Reply #7 on: October 23, 2012, 03:09:51 PM »
Is it possible that libtest.exe have exported functions ?

Or... misnamed import functions?

Offline TimoVJL

  • Global Moderator
  • Member
  • *****
  • Posts: 2153
Re: Compilation order
« Reply #8 on: October 23, 2012, 03:58:40 PM »
Maybe there is header file with something like this:
__declspec(dllexport) void _cdecl foo(void);

For example
Code: [Select]
//Test_Main.c
#include "TestLib.h"
// in TestLib.h is this line:
//__declspec(dllexport) void _cdecl foo(void);
int main(int argc, char **argv) {
foo();
return 0;
}
Code: [Select]
Building TestLib.exe.
Creating object: C:\code\PellesC\Forum\jev\TestLib.exp
Creating library: C:\code\PellesC\Forum\jev\TestLib.lib
Writing debug information
Compacting CodeView information
Done.
Code: [Select]
//TestLibS.c
__declspec(dllexport) void _cdecl foo(void) {};
« Last Edit: October 23, 2012, 04:00:49 PM by timovjl »
May the source be with you