Archived

This topic is now archived and is closed to further replies.

El Duderino

Linking question (Borland V4.52)

Recommended Posts

El Duderino    122
Howdy, thanks for looking at this dry as dust problem Bit of background, I am trying to compile/link a piece of demo source using Borland C++ V4.52 ... Win32, GUI project, using DirectDraw. I have Dx 8 SDK and for the project the .lib directory is pointing to my .libs. Compile is fine. Sooo, I have the famous "Unresolved External ''DirectDrawCreateEX''". Also his evil mate "Unresolved External ''_IID_IDirectDraw7''". I believe I need to link in the ddraw.lib somehow. I have #define INITGUID in there so all _should_ be well with dxguid.lib ... the problem is every blow by blow description is for VC++6 when it comes to actually linking a .lib to a project In "Options" ==> "Tools" there is a groover "Linklibrary" that "Links a .dll and creates and import .lib" but I''m not convinced this is what I want to do, I have the .lib I want ready to go from Dx 8 SDK and my .dll is from Dx 7 (which I play games with) ... anyone shed any light ? El Duderino "Buggy game ? No ... they''re supposed to be formula ones"

Share this post


Link to post
Share on other sites
NuffSaid    122
You might need to implib the dxguid.lib from the MSVC format into a Borland format. If that doesn''t work, get a new compiler

==========================================
In a team, you either lead, follow or GET OUT OF THE WAY.

Share this post


Link to post
Share on other sites
risingdragon3    382
Argh, don't listen to NuffSaid. All you need is to link in ddraw.lib. This is still available in DX8 as ddraw.lib, but of course only for VC.
You'll need to implib ddraw.dll, do it like this:
1) Bring up a command prompt
2) cd c:\windows\system
3) try implib ddraw.dll c:\ddraw.lib (then move it where-ever you want)
4) if that doesn't work do a find for implib.exe. Then use that path.

[edit] Its system, not system32 [/edit]
------------------------------
BCB DX Library - RAD C++ Game development for BCB

Edited by - c++freak on January 28, 2001 2:04:38 AM

Share this post


Link to post
Share on other sites
NuffSaid    122
Geez,
so sue me. That''s how the implib works for lcc-win32, so I thought it should be the same for Borland (*Gives a sheepish grin*).

==========================================
In a team, you either lead, follow or GET OUT OF THE WAY.

Share this post


Link to post
Share on other sites
El Duderino    122
Thanks for the advice fellas.

There are new problems though, and still I am not clear on some things.

First thing - if I did have the borland compatible ddraw.lib would I have to do more than put it in (for example) e:\bc45\libs folder and make sure I set borland to point to this for all its library needs ? Then all required .libs will be sucked in at link time "automagically" ?

Second thing - when using implib the format is : implib *.lib *.dll ... ... doing the reverse can be corrupting

Third thing - whenever I try to do an implib I get "exception C0000005 : access violation" in implib.exe

I'll try running from ms-dos mode. This borland thing is a real battle.
[edit : tried from there and no luck, however there seems to be a way to do it using "Options" ===> "Tools", then putting the tool (implib) on the menu bar, and running it from there. Somehow.]
[edit : discovered the fine art of putting libraries into the project window. Big day for me. Also used a util called dll2def as an intermediary then made .lib files from .def files ... which where made from .dll files ... down to _one_ link error !!! Still can't get rid of one of them, I think I should grab Dx 7 SDK and try that at some stage]

El Duderino

Edited by - El Duderino on January 28, 2001 10:05:48 AM

Edited by - El Duderino on January 28, 2001 11:22:28 AM

Share this post


Link to post
Share on other sites
risingdragon3    382
NuffSaid: Your right about implibing dxguid.lib, but you also need ddraw.lib. Didn''t mean to say your wrong tho''
1) Nope, you''ll have to do this (in a .cpp file): #pragma link "ddraw.lib" (after you''ve put the .lib in the correct directory)
or
just add the .lib to the project.
Ahha, all of that wiped by carefull reading of the [edit]''s.
Oh well.
What is the last link error you''re getting?

------------------------------
BCB DX Library - RAD C++ Game development for BCB

Share this post


Link to post
Share on other sites
El Duderino    122
The last unresolved external is the "_IID_IDirectDraw7" one. The other one was vanquished by including the newly created ddraw.lib in the project.

I am thinking that this "_IID_IDirectDraw7" one might be solved by (as you suggest) pulling in a borland friendly dxguid.lib (even though I have #define INITGUID up there) ... the trouble with this plan is, I have no dxguid.dll to implib.

Judging by the size of the dxguid.lib I have (over 100k) it has always been a static library complete and unto itself, with no reference to any .dll. Of course, borland chokes at the smell of it "Linker Fatal : Bad Object File '..\..\lib\dxguid.lib' near file offset 0".

Not sure what to do now. I might dredge the net for a borland compatible dxguid.lib I suppose.

[edit : I am now convinced utterly that the solution requires a borland compatible dxguid.lib ... it needs to be Dx7 or greater, of course, which is the tough bit. I can find a Dx5 one, but this isn't going to cut it with Ddraw7 obviously. There must be a way somehow.]

Thanks again for your help NuffSaid and c++freak I have landed at your site c++freak a couple of times in my searches. You are a champion of borland !!! Which is damn lucky for me

El Duderino

Edited by - El Duderino on January 28, 2001 11:03:27 PM

Share this post


Link to post
Share on other sites
El Duderino    122
Solved !!

The solution to this last external was to put #define INITGUID *above* my #include "windows.h"

Lord only knows why the author of this demo put it below ... I had to fix so many compile errors, then this linker thing ... just to get a demo working. Well I've learned a lot from this demo and I'm yet to examine the functionality of the code

Another interesting thing - this always seems to be the case - whenever I get a successful compile/link from borland, the .exe is always *way* smaller than the .exe that ships with the demo.

This one for example downloaded with an .exe put together with M$VC++6 ... 161k. When I optimise for speed my .exe is 49k and when I optimise for size it's a mere 29k ... all three versions execute fine. I wonder though what it would mean for apps that are really need for speed though ?

El Duderino

Edited by - El Duderino on January 28, 2001 12:02:08 AM

Share this post


Link to post
Share on other sites