Function declaration type in PGCPP

Hello!

I have some questions about using PGCPP on Win32 platform (sorry, but my English is not very good ;-):

  1. Are the compiler support various declaration of functions, _cdecl, _fastdecl, _stdcall and etc?

E.g. In some library functions was declarated with _fastdecl type:
int _fastdecl some_todo(int param);

In the some.lib file function is named @some_todo. When I compile file which use some.lib PGI Compiler generate function with name _some_todo in result object file. At the link stage error occurs.
Microsoft CL and Intel ICL generate correct name of function.
So, PGI Compiler ignore function declaration type?

  1. Why to many calls to PGI libraries in simple files which not call any PGI library function in code? How I can disable to use PGI library by compiler?

Thanks.

Hi Logger,

) Are the compiler support various declaration of functions, _cdecl, _fastdecl, _stdcall and etc?

PGI supports _stdcall and _cdecl but not _fastdecl.

In the some.lib file function is named @some_todo. When I compile file which use some.lib PGI Compiler generate function with name _some_todo in result object file. At the link stage error occurs.
Microsoft CL and Intel ICL generate correct name of function.
So, PGI Compiler ignore function declaration type?

If I remember right, symbols with “@symbol_name” are import library declarations and used to resolve external symbols in DLLs. Try compiling and linking with “-Bdynamic” to link with dynamic link libraries. Note you may need explicitly declare these symbols using “__declspec(dllimport)”. By default, PGI links with static libraries.

  1. Why to many calls to PGI libraries in simple files which not call any PGI library function in code? How I can disable to use PGI library by compiler?

You’re mostly likely using many PGI library calls since any std function or STL are all contained in a PGI library. For example, “cout” is a PGI function call.

Hope this helps,
Mat

Hello, Mat!

Thank you for respond!

Why the fast call is not supported? I think this may be increase code speed with functions or methods with many parameters.

In my case I talk about static library. Problem is in functions name style.
This library was compiled by CL with _fastdecl and all functions names within library has prefix ‘@’. If function is declarated with _cdecl or stdcall it name begin from '’ character, may be this is a CL feature.
Also when function is declarated with _fastdecl two first parameters passed to ECX and EDX registers.

So, if I don’t use any std or STL functions the calls to PGI library shouldn’t be in object file?

  1. Could I compile CPP file by PGCPP into assembler file?

Hi Logger,

There’s no technical reason why we haven’t yet implemented fastcall, rather it was simply determined to be a lower priority item.

This library was compiled by CL with _fastdecl and all functions names within library has prefix ‘@’. If function is declarated with _cdecl or stdcall it name begin from '’ character, may be this is a CL feature. Also when function is declarated with _fastdecl two first parameters passed to ECX and EDX registers.

While you probably wont be able to link directly with this library, you could write a wrapper library in C (using CL).

So, if I don’t use any std or STL functions the calls to PGI library shouldn’t be in object file?

If you’re not using anything C++ specific (except for maybe simple classes), not compiling the main program, and using low optimizations, then you might be able to remove the dependency on the PGI runtime libraries. Why do you need to remove the dependencies?

  1. Could I compile CPP file by PGCPP into assembler file?

Yes using the “-S” flag or “-Mkeepasm”. However, you would need to use our assembler to create the object.

  • Mat

So it possible implemented in future version of compiler?

Really this is good solution for this time.

For some reason I try to avoid using of runtime and std libraries specially if this calls making implicity and I couldn’t control this. The binary file size is increasing and I don’t know how this library was implemented.

Thank you, it works. What assembler you recommend to produce object file from .s file?

  1. In one library I use Interface similar as used in COM technology. The interface declarated as abstarct class with all virtual methods. The class which implemented this interface is derived from interface abstract class, compiled by CL and link as DLL library. If I try to use this interface from PGI are the format of VTABLE is concur with format generated by CL?

Hi Logger,

Sorry for my late reply, I’ve been away attending the SC08 conference.

While it is possible that we could support fastcall in the future, the honest answer is that it is low priority feature. This combined with your use of other Microsoft specific features like COM, you might be better off continuing to use CL instead of pgcpp for this project.

What assembler you recommend to produce object file from .s file?

You would need to use the ‘as32’ assembler that accompanies the PGI compilers.

  • Mat

The VTABLE format of PGCPP is incompatible with VTABLE of CL?
Are the common standards of VTABLE format?

Could you, please, get me URL address of ‘as32’ homepage?

What linker you recommend to use with PGI on Win32 platform?

Hi Logger,

The VTABLE format of PGCPP is incompatible with VTABLE of CL?
Are the common standards of VTABLE format?

PGI C++ and MS C++ vtables are not compatible and no, there is no common vtable format.

Could you, please, get me URL address of ‘as32’ homepage?

The ‘as32’ assembler is a PGI port of GAS using the binutils source code. The source for as32 is available directly from PGI. Please send a request to sales@pgroup.com if you would like a copy.

What linker you recommend to use with PGI on Win32 platform?

MS Link.

  • Mat

Ok. Thank you for support!