Thread overview
MCVC++ Compatibility.
Aug 31, 2003
Ilya Minkov
Sep 01, 2003
Walter
Sep 02, 2003
Ilya Minkov
Sep 03, 2003
Walter
August 31, 2003
Hello.

I intend to (try to) write a plug-in for Jeskola BUZZ sound machines system, and i wanted to know whether there's any way to avoid using Microsoft compilers.

The Plug-in interface consists out of few functions, which get packaged into a DLL, and simply deliver some objects to the host application. So, it would requiere, that:

 - an (C++) object from a DLL must have exactly the same format, VTable structure, calling conventions as MSVC code;
 - the key functions are __fastcall, so a corresponding calling convention must exist.

I found the CTG not really clear on these subjects.
Thanks beforehand.

-eye

September 01, 2003
The DMC++ compiler is compatible for object layout and vtables. It is compatible with the C++ calling convention, stdcall, and pascal conventions. It does not support the fastcall convention, though you could deal with that by writing a small shim.

"Ilya Minkov" <webmaster@midiclub.de.vu> wrote in message news:bitu98$2978$1@digitaldaemon.com...
> Hello.
>
> I intend to (try to) write a plug-in for Jeskola BUZZ sound machines system, and i wanted to know whether there's any way to avoid using Microsoft compilers.
>
> The Plug-in interface consists out of few functions, which get packaged into a DLL, and simply deliver some objects to the host application. So, it would requiere, that:
>
>   - an (C++) object from a DLL must have exactly the same format, VTable
> structure, calling conventions as MSVC code;
>   - the key functions are __fastcall, so a corresponding calling
> convention must exist.
>
> I found the CTG not really clear on these subjects.
> Thanks beforehand.
>
> -eye
>


September 02, 2003
Walter wrote:
> The DMC++ compiler is compatible for object layout and vtables. It is
> compatible with the C++ calling convention[...]

Thanks.

> It does not support the fastcall convention, though you could deal with that
> by writing a small shim.

How? Dig up the calling conventions info and go assembly?
Do you have any pointers handy?

Thanks.

-eye

September 03, 2003
"Ilya Minkov" <webmaster@midiclub.de.vu> wrote in message news:bj38oi$m1b$1@digitaldaemon.com...
> Walter wrote:
> > The DMC++ compiler is compatible for object layout and vtables. It is compatible with the C++ calling convention[...]
>
> Thanks.
>
> > It does not support the fastcall convention, though you could deal with
that
> > by writing a small shim.
>
> How? Dig up the calling conventions info and go assembly? Do you have any pointers handy?

A shim would look like this:

int __fastcall theirfoo(int a, int b);

extern "C"
{
    int __cdecl myfoo(int a, int b)
    {
        return theirfoo(a, b);
    }
}

It's probably easiest to compile it in MSVC++, since they support the fastcall convention. Otherwise, it'll have to be done with a bit of inline assembler to do the call to theirfoo(). One way to do that is to compile it in MSVC++, disassemble it, and plug the assembler into DMC++'s inline assembler.