stdlib.h Borland C++ & VC++

Hey guys,

Foremost, thanks for the help with my previous questions.

Quick background, I have an application that was build in Borland C++ 4.52 (old I know)... I am trying to move that code over to Visual Studio 2010 (VC++ 10.0).

My question is in regards to the stdlib.h library.

Did Borland C++ 4.52 and VC++ 10.0 implement this library differently? I know different vendors could implement them differently... hence why the C\C++ standard exists I guess.

I have a particular compile error in my code
error C2146: syntax error : missing ';' before identifier '_EXPFUNC'

Clicking on it brings me to this line of code
extern int _RTLENTRY _EXPFUNC system(const char * __command);

Now to be honest, that is pretty alien to me :)
But I did a 'google' serach and I got this page

ftp://ftp.ingv.it/pub/giuseppe.tutone/bc45/INCLUDE/STDLIB.H

Now, that particular line of code above does exists in this library. But looking at it, to be honest... I am pretty clueless.

Anyways, my thought is that Borland C++ 4.52 stdlib.h has a different implementation then that of VC++ 10.0 and hence my error.

Before this, I always assumed that stdlib.h was the same across the board (but this is definitely changing my mind).

My question... are they different, no doubt the time gap between the 2 compilers has not helped?

I don't need a solution... I just need to know the cause of the error.

Many thanks guys.
As you guessed, the C++ standard dictates that stdlib.h be the same as that defined in the C standard, which only dictates the functions it must provide - it does not force the writer to implement the functions in a certain way. Clearly, then, two versions of stdlib.h written by different people and released with different compilers are going to be different.

If I had to guess, the problem here is that _EXPFUNC isn't defined anywhere that the compiler can see. Are you feeding the stdlib.h from Borland to your Microsoft compiler? That's a bad idea. Use the one that came with the Microsoft compiler.

You'd be better off switching to the C++ <cstdlib> header anyway.

Topic archived. No new replies allowed.