Author Topic: Trouble creating import library  (Read 5553 times)

Bill

  • Guest
Trouble creating import library
« on: November 05, 2005, 06:32:06 am »
This seems like a bug, but then I don't know what I'm doing.

I have C::B RC2, MS toolkit, platform SDK, and .NET SDK.
I am trying to compile OGRE.
I have worked through most of the prolems (I hope), but I am stuck on this one.
The packages are supposed to create import libraries however only some of them are. All the package's target options have "Create import library" checked. Yet some build the library (e.g. OgerMain, Plugin_ParticleFX) and some don't (e.g. Plugin_CgProgramManager, PlatformManager_Win32). I can not find any difference between any of the compile options between the packages. I even looked .cbp files and could not see a difference.

As an interesting experiment I tried to break the working ones by unchecking the "Create import library," but it still built the library anyway. argggg....  I don't understand.

I'm hungry and tired so I'm going home. I hope someone can help me.


Offline mandrav

  • Project Leader
  • Administrator
  • Lives here!
  • *****
  • Posts: 4315
    • Code::Blocks IDE
Re: Trouble creating import library
« Reply #1 on: November 05, 2005, 10:02:34 am »
The "Create import library" checkbox doesn't work for VC Toolkit. It always generates an import library, except if specific options are passed to the linker. Anyway, you don't need import libraries for all the Ogre DLLs (only OgreMain IIRC).
Be patient!
This bug will be fixed soon...

Offline Urxae

  • Regular
  • ***
  • Posts: 376
Re: Trouble creating import library
« Reply #2 on: November 05, 2005, 10:40:03 am »
The "Create import library" checkbox doesn't work for VC Toolkit. It always generates an import library, except if specific options are passed to the linker.

So wouldn't it be possible to reverse the logic then? (If the box is not checked pass an extra parameter to the linker)
If this is not possible in the current compiler framework, this might be something to remember during the coming redesign.

Bill

  • Guest
Re: Trouble creating import library
« Reply #3 on: November 05, 2005, 05:51:35 pm »
The "Create import library" checkbox doesn't work for VC Toolkit.

Ah! So I'm not going crazy. That's good to know.

It always generates an import library, except if specific options are passed to the linker. Anyway, you don't need import libraries for all the Ogre DLLs (only OgreMain IIRC).

Any idea what those options that stop it from building the .lib file might be?

Offline mandrav

  • Project Leader
  • Administrator
  • Lives here!
  • *****
  • Posts: 4315
    • Code::Blocks IDE
Re: Trouble creating import library
« Reply #4 on: November 05, 2005, 08:26:00 pm »
Quote
Any idea what those options that stop it from building the .lib file might be?

If I knew I would have implemented this option :oops:
Be patient!
This bug will be fixed soon...

Bill

  • Guest
Re: Trouble creating import library
« Reply #5 on: November 06, 2005, 06:58:26 pm »
I have done some searching and found that the way to create an import lib is via the "/def" option to the linker. So, for example, I can make Plugin_CgProgramManager build a import library by adding  "/dev:..\misc\OgreCgProgramManager.def" to the linker options.


This doesn't answer the question as to why it builds the library in some cases and why it doesn't in others without the option specified.  :(


[Edit] In case anyone is interested, and after a few more bumps, I did finally get OGRE to compile and run with C::B and the free MS C++ compiler. As OGRE is rather involved I think this shows that C::B with the MS compiler is a viable alternative to visual studio.
« Last Edit: November 08, 2005, 04:15:12 am by Bill »

RayGun

  • Guest
Re: Trouble creating import library
« Reply #6 on: November 18, 2005, 08:39:58 am »
In case anyone is interesed, I ran into this problem myself, yesterday. What I found out, is that VC++ linker doesn't generate import library if there's nothing to export (or so it seems to be). Despite the fact that my dll project had def file in it, C::B build system obviously just ignored it. So I used /EXPORT keys (I guess, /DEF also would work).

As to why some of your projects generated libs and some didn't. Maybe those projects that generated import libraries use __declspec(dllexport) to tell the compiler about the symbols to be exported.

So, to summarize, there are three ways to export something -
1) def file
2) /EXPORT key
3) __declspec(dllexport) in the source

If your project doesn't use any of these, you don't get a lib for your dll.