• C

What are _Optlink and _System

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.

LVL 20
Daniel Van Der WerkenIndependent ConsultantAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Daniel Van Der WerkenIndependent ConsultantAuthor Commented:
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.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.