www.digitalmars.com         C & C++   DMDScript  

c++ - MCVC++ Compatibility.

reply Ilya Minkov <webmaster midiclub.de.vu> writes:
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
Aug 31 2003
parent reply "Walter" <walter digitalmars.com> writes:
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
Aug 31 2003
parent reply Ilya Minkov <webmaster midiclub.de.vu> writes:
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
Sep 02 2003
parent "Walter" <walter digitalmars.com> writes:
"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.
Sep 03 2003