0

Anybody knows how to integrate Pdcurses with Embarcadero C++ Builder ?

I've added the library, pdcurses.lib to my project and I've added the pdcurses.dll in the deployment section. but whatever I might do, I still got a link32 error.

Johan
  • 74,508
  • 24
  • 191
  • 319
  • But why don't you show us the error? – manuell Dec 30 '13 at 11:44
  • It's [ilink32 Error] Error: 'C:\USERS\RADU\DESKTOP\FOTBAL_ASCII\PDCURSES.LIB' contains invalid OMF record, type 0x21 (possibly COFF) –  Dec 30 '13 at 11:51
  • 1
    first, edit your question with the errors, do not add a comment. Some people will skip right over the question if it does not contain all the information needed. Second, try building pdcurses from source and create a builder compatible DLL yourself. – Gregor Brandt Dec 30 '13 at 18:07
  • Thank's @GregorBrandt for reminding me about the sources. So here;s a small tutorial for those who are in a hurry, and need to use pdcurses with C++ Builder: –  Dec 30 '13 at 18:43

2 Answers2

1

Googled it for you.

The lib file is not compatible with Borland's OMF file format.

Use the Borland's IMPLIB tool, passing the DLL as argument. It will generate a Borland compatible import library. Link with that library.

Edit: Another option is to use Borland's COFF2OMF tool on the Microsoft import library.

manuell
  • 7,528
  • 5
  • 31
  • 58
  • I've did that and now I've got 3 link32 errors, after I've added the library generated by IMPLIB, from the .dll file. These are the same errors I get if I don't add the library at all, so I'm thinking the linker doesn't "likes" the IMPLIB generated library that much. –  Dec 30 '13 at 12:21
  • Here are the errors: [ilink32 Error] Error: Unresolved external '_stdscr' referenced from C:\USERS\RADU\DESKTOP\FOTBAL_ASCII\WIN32\DEBUG\OBIECTE.OBJ [ilink32 Error] Error: Unresolved external '_wgetch' referenced from C:\USERS\RADU\DESKTOP\FOTBAL_ASCII\WIN32\DEBUG\OBIECTE.OBJ [ilink32 Error] Error: Unable to perform link –  Dec 30 '13 at 12:23
  • Same errors as if you don't use the lib? Does it means that you are only using theses 2 functions? – manuell Dec 30 '13 at 12:32
  • Those errors appear if I don't include the library in my project at all. So I'm thinking the linker doesn't reads the newly generated library, or something like this. –  Dec 30 '13 at 12:47
  • Do you also got a H (header) with the lib and the DLL? – manuell Dec 30 '13 at 12:48
  • yup, got them, downloaded from here http://sourceforge.net/projects/pdcurses/files/pdcurses/3.4/ –  Dec 30 '13 at 12:53
  • Several links here. Which one? – manuell Dec 30 '13 at 12:57
  • The package worked via CodeBlocks, but I really really like working with Embarcadero's C++ Builder. –  Dec 30 '13 at 13:03
  • I suggest you try the coff2omf tool. Simply convert the pdcurses.lib from COFF to OMF. It usually works. – Samuli Hynönen Dec 30 '13 at 13:35
  • Okey, I have to admit @SamuliHynönen that solved the problem on the errors side of the matter, but now no Debug console appears anymore. It's like it wants to, but it dissapears right away. –  Dec 30 '13 at 13:47
  • @SouthPole You did see that I cited COFF2OMF in my answer? – manuell Dec 30 '13 at 14:08
  • Yeah @manuell, I see it now, it's just that I've rushed to try that IMPLIB Tool. Anyway coff2omf makes the errors dissapear but so is the console. –  Dec 30 '13 at 14:15
  • @SouthPole Then you have another problem. Accept and/or upvote, and post another question if debugging doesn't solve your other problems. Don't forget to post a minimal reproducing code, then. – manuell Dec 30 '13 at 14:17
  • The problem is still making pdcurses work with C++ Builder, as the program compiles / runs fine if I don't include the "curses.h" header file. –  Dec 30 '13 at 14:27
  • @SouthPole But I can't guess. What is the problem if you include "curses.h" ? – manuell Dec 30 '13 at 14:28
  • Beats me @manuell. I basicaly need pdcurses only to make my console application run smoother, as it's almost done. If there's another alternative to pdcurses, under windows, I will gladly accept it. –  Dec 30 '13 at 14:38
  • @SouthPole I can't follow a moving target the whole day, by comments. You had a link problem, I helped solving it. If you have others problems, state them clearly in a question, after reasonable efforts to solve them by your self. – manuell Dec 30 '13 at 14:42
  • Okey thanks for your time @manuell. I have no knowledge of what COFF or OMF formats really are so I guess I'll start with that. At least now I have a lead on what might be the problem. –  Dec 30 '13 at 14:48
  • As there is the possibility, even if the linker was tricked to believe that's the format it needs, it crashes when he tries to handle it as something it really ain't (if that makes any sense :-)) –  Dec 30 '13 at 14:51
  • let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/44166/discussion-between-manuell-and-south-pole) – manuell Dec 30 '13 at 14:52
0

Here's a small how to, for those who need it in a hurry:

Go to http://sourceforge.net/projects/pdcurses/files/pdcurses/3.4/ and download the pdc34dllw.zip and the pdcurs34.zip that contains the source files. Extract the files from pdc34dllw.zip, and keep only these ones: curses.h, pdcurses.dll and optionally panel.h

After that, extract the other archive, pdcurs34.zip and go to win32 folder. There in your windows console do:

make -f bccwin32.mak

From all those files generated after the build, search for pdcurses.lib, as you will only need that. Copy the files curses.h, pdcurses.dll from the first archive, and the newly generated pdcurses.lib in your C++ Builder project folder. Add the pdcurses.lib to your project, include the "curses.h" header file, hit F9 and it should work fine.