We help IT Professionals succeed at work.

What are _Optlink and _System

Daniel Van Der Werken
Medium Priority
Last Modified: 2010-08-05
Okay.  I hate to admit it, but I'm a one-platform kind of guy.  Most of my programming has been on Windows.

I'm trying to build some code that seems cross-platform.  AIX, OS/2, Windows.

I even went from Visual Studio 2005 back to Visual Studio 6.0 just to make working with this code easier.  Seems Microsoft made a lot of core changes to the basics in this last release.

Anyway, I'm getting the following error:

error C2146: syntax error : missing ';' before identifier 'AhiInsItemImage'

So, I define __WINDOWS__ in my project settings and that seems okay.  However, I can't figure out exactly why I'm getting this error.  

#if defined(__OS2__)
   #define AHIITPTY_API _System  
#elif defined(__WINDOWS__)
   #define AHIITPTY_API _System
   #define AHIITPTY_API

unsigned long AHIITPTY_API AhiInsItemImage(                          
                        unsigned short count,
                        AHIITIMG       ReqList[] );

Obviously, AHITPTY_API isn't defined properly.  I Googled (it's a verb now, I think) _System but there's a lot of chaff there to go through.  Heck, why do I have all of these expert points myself if I can't ask a question now and then?

Anyone able to help me out here?  I know we're defining an API call, but I'm not sure what the basis is, etc.

Watch Question

Daniel Van Der WerkenIndependent Consultant


Just a note:

I replaced _System with __stdcall and it compiles, but I'm not sure that's the best calling convention to us.  Should I use __cdecl instead?  One cleans up the stack by itself and one doesn't.  I'm thinking perhaps __cdecl is a better choice for cross-platform code.  Any ideas?

Because you cannot share binaries between different platforms, it does not matter which calling convention you use. For each platform you have to recompile. The only thing you need to take care about is compiling all code on a platform with the same settings. Otherwise you will get either linker errors, or your program will simply crash.

Not the solution you were looking for? Getting a personalized solution is easy.

Ask the Experts
Access more of Experts Exchange with a free account
Thanks for using Experts Exchange.

Create a free account to continue.

Limited access with a free account allows you to:

  • View three pieces of content (articles, solutions, posts, and videos)
  • Ask the experts questions (counted toward content limit)
  • Customize your dashboard and profile

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.


Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.