On Tuesday 11 May 2004 02:39, you wrote:
Marten Jan de Ruiter wrote:
The default name for a pascal procedure does not work correctly anymore. (See the output for version number and so on below).
Explicitly declaring the name works, so a workaround is available. That can be done as follows: procedure p_routine; attribute (name='P_routine')
As Eike has already stated, this is not a work-around, but the "official" way. Relying on the default linker name was never a good idea, I've been saying this for years. (And with qualified identifiers, the default linker names will (must) become different again.)
Actually, it's quite simple. If you want to link it as foo, declare it so. This way, you don't have to use these ugly first-capital names either. :-)
Frank
I agree that explicit coding is preferable to relying on default behaviour. However, for older gpc compilers, the attribute approach does not work. Of course, I could start detecting which compiler is used, set proper environment variables, and so on. A better approach seems to be to verify which compilers are used by my colleagues. It might very well be that no older compiler is used, and I am making it hard for myself unnecessarily.
Hopefully I can throw out the ugly constructs as #ifdef PASCAL #define GPC_EXTERNAL external c #define GPC_ASMNAME asmname #else #ifdef GPC_NEW #define GPC_ASMNAME external name #define GPC_EXTERNAL external #else #ifdef GPC_OLD #define GPC_ASMNAME asmname #define GPC_EXTERNAL C #else #error none of PASCAL, GPC_OLD and GPC_NEW defined #endif #endif #endif
Var X_stringtoput : string80 ; GPC_ASMNAME 'x_stringtoput' ;
Thanks for the help.
Regards,
Marten Jan de Ruiter