Fog Creek Software
Discussion Board




codewarrior and visual studio .DLLs on Windows

Anyone ever have any problems between writing a program in Codewarrior and a .DLL in visual studio?  The .DLL interface seems to corrupt some values, but leave others intact... I get a bunch of 1 bits set, like it is doing some weird sign extension thing, but not really.

Rob
Tuesday, May 11, 2004

Try searching on http://weblogs.asp.net/oldnewthing/

esp Jan 2004 entries on Calling Conventions and other similar entries.

Nitin Bhide
Tuesday, May 11, 2004

What languages are you using?  Name mangling may vary by compiler, and I don't think there is yet a standard accepted ABI for C++ in use on Windows.

anon
Tuesday, May 11, 2004

CodeWarrior's Win32 DLL calling convention is based directly on VC++s. including name mangling and parameter passing.  However, if you pass standard library objects across the DLL boundary; for example calling malloc() to allocate space in the DLL, but using free() in the client program, you'll have problems, as CW and VC++ use different standard libraries and runtime libraries.

Ben Combee
Tuesday, May 11, 2004

I had few strange experiences with DLLs, but I think the
problem was that my friend used VisualStudio .net or
I think it was even that cheap C#-only version of VS.
Somwhere I read that VS .net can't produce normall Win32
DLLs.

Anyway, my friend couldn't create a DLL to use it from his
C# application. But when I copied his DLL and played with
names for a while (all mangling variations) I managed to use
it from my app written in CodeWarrior.
And then I wrote a DLL in CW with same functionality and it
worked from both my app and his C# app.

DLL was basically very simple proc in a fashion like this:
(with all DLL decorations)

int  AddOne (int a)
{
  return (a+1);
}

My friend stopped bothering with DLLs and I don't have VS,
so I have never played with these combinations again.

VPC
Tuesday, May 11, 2004

*  Recent Topics

*  Fog Creek Home