magiblot / tvision

A modern port of Turbo Vision 2.0, the classical framework for text-based user interfaces. Now cross-platform and with Unicode support.
Other
2.04k stars 151 forks source link

Unresolved External 'SetConsoleActiveScreenBuffer' in DOS with BC++ 4.52. #20

Closed sduensin closed 4 years ago

sduensin commented 4 years ago

After much hackery, I have managed to build TV using BC++ 4.52 / PowerPack / TASM4 in DOSBox-X with Windows 3.11 and Win32s. After creating a project for my sample program (basically the tutorial chapter from the TV manual) and adding TV32 to my library list, I get the following after compilation:

Linker Error: Unresolved External 'SetConsoleActiveScreenBuffer' referenced from module ..\SOURCE\TVISION\HARDWRVR.CPP

At this stage of my TV knowledge, I'm at a loss. Ideas?

Thanks again!

magiblot commented 4 years ago

Hi Scott,

I'm so sorry! I forgot to write about this in the project's Readme.

Since DPMI32 builds work in modern Windows, I used some features that are exclusive to Windows.

To fix the linker error, you have to link against import32.lib. Then you will get a runtime warning like this:

But you will be able to run the application because there are runtime checks to avoid invoking SetConsoleActiveScreenBuffer on DOS.

To disable this feature, so that you don't have to change the compilation settings, comment out the code surrounded by if( platform == plWinNT ) in source/tvision/hardwrvr.cpp.

Also, unless you have a specific reason for using Windows 3.11, I recommend compiling from Windows XP. I also began using Windows 3.11/ Windows 95 to compile this and never looked back after trying Windows XP.

Cheers.

magiblot commented 4 years ago

The build instructions have been updated with this information.

sduensin commented 4 years ago

Awesome support, yet again! Thank you!

I'm using 3.11 because I already have to use DOSBox for other things. Figured I'd just keep rolling with it. :-)

Also, I noticed in the BC++ project that it looks for TPOINT.CPP. I just created an empty one to avoid needing to modify the project.

magiblot commented 4 years ago

Oh, tpoint.cpp. Yes, I removed that file in https://github.com/magiblot/tvision/commit/8351bd174ea5a98def47cd040cc7e3f8047f1473 because I thought these functions would be better off inlined.

By the way, I also used to use the IDE, and never touched it again after figuring out how to build from the command line using the makefile. Its simpler and faster. So I removed the project file from the repository, because it was outdated. You may also find it easier to do it this way.

You are welcome! Cheers.

sduensin commented 4 years ago

I had better luck with the IDE under 3.11 than the command line in DOS. But I am eventually going to move to the makefile so I can automate things.

magiblot commented 4 years ago

I also used to get impossible errors when building from the command line on DOS. That's one of the reasons why I moved to Windows XP.