views:

350

answers:

1

At the risk of appearing a dinosaur, I have some old C++ code, compiled with Borland C++, which sets registers, and interfaces to an Assembler module, which I would like to modernize. I have just installed MS VC++ Express, and needless to say a lot of things don't work! The default seems to be Win32, which is fine, so I have blanked out FAR and HUGE. PASCAL seems to map to __stdcall. So I have a macro

 #define THRCOMP  extern "C" int FAR PASCAL _Export

where THRCOMP goes in front of a module name. This presumably results in something like

extern "C" int __stdcall _Export <modname>;

which the compiler doesn't like, and puts out a message about an "anachronism" (doesn't say what!). What is wrong?

Also the old code sets has in-line Assembler which I need to turn into a separately compiled subroutine - is there a (free) Assembler, and can it link Assembler obj decks in with C++?

By the way, I can't see my obj decks - but WinZip picked them up! Explanation?

Generally, is there a guide to migrating old C++ code?

Thanks in advance.

+1  A: 

A couple of specific things from your example:

  • VC doesn't like _Export at all.
  • the anachronism is that you have modifiers (like __stdcall) on a data declaration. If <modname> doesn't have parens it's a data declaration and the modifiers don't do anything. If <modname> is a function implemented in assembly, you should still have the declaration include the argument list.

For example:

extern "C" int __stdcall  modname( int x);

You can get a free assembler from the Windows Driver Kit (WDK - what used to be called the DDK), but if you're current code is written using Borland's TASM compiler it might not be using the same syntax so there might be quite a bit of work porting it. However, if the current assembler is 16-bit code, you're going to have a lot of work porting it to 32-bit assembler anyway...

Michael Burr
Thanks for your prompt answer! _export was the problem! Any idea what happened to my obj files? Thanks in advance.
Paul Morrison
I'm not sure what you mean by "can't see my obj decks" - can't see them in what?
Michael Burr
I just changed an option to display the generated Asm, and the obj decks are now visible! Winzip picked them up before, but I couldn't see them in Windows Explorer - seems OK now :) Still got a few weirdnesses, but I hope to track them down eventually... Thx again.
Paul Morrison