NO

Author Topic: __usercall possible in PellesC for custom calling conventions?  (Read 5353 times)

Seltsamuel

  • Guest
__usercall possible in PellesC for custom calling conventions?
« on: January 25, 2009, 10:40:42 PM »
Hi,

is there something like __usercall possible in PellesC ?
For a Project im working on i need to interface code with as it seems custom calling conventions.
so something as __usercall would be awesome so there is no need to make callstubs with asm inside.


Example:
int __usercall myfunc<eax>(int a1<eax>, int a2<esi>);

so that its possible to tell the compiler the registers to use for the parameters.
This would make it possible to make prototypes and happy call the code with clean c.

Greetings

Seltsamuel

Offline Pelle

  • Administrator
  • Member
  • *****
  • Posts: 2266
    • http://www.smorgasbordet.com
Re: __usercall possible in PellesC for custom calling conventions?
« Reply #1 on: January 28, 2009, 04:36:12 PM »
There is no way of doing this without assembly, and it sounds to specialized to be added to the compiler I think...
/Pelle

Seltsamuel

  • Guest
Re: __usercall possible in PellesC for custom calling conventions?
« Reply #2 on: January 31, 2009, 01:57:07 AM »
Hi,

hm thats sad :-( it would be a good way to cooperate with IDA PRO and an even better way around the horrible optimization of MSVC7 code giving Parameters in EAX and ESI and randomly other Registers.

It seems there is no other way then doing bloody function stubs overhead in assembly when you want to interface these optimized functions in a bin file.

Greetings

Seltsamuel

severach

  • Guest
Re: __usercall possible in PellesC for custom calling conventions?
« Reply #3 on: January 31, 2009, 06:18:35 AM »
If it's MSVC7 then what you have may be the fastcall convention. Compare the MSDN and Pelles help descriptions. With Pelles you're in luck since the fastcall implementation should be the same as MSVC. Since you don't name the right registers for fastcall you might be calling into MSVC C++ functions where Pelles C won't be able to help.

Calling Conventions