Discussion:
create link library for VC++ 2005 using Open Watcom C++
(too old to reply)
Lynn McGuire
2011-04-13 16:07:35 UTC
Permalink
Raw Message
Hi,

I am using Open Watcom C++ 1.9 in my app

wlib /fa dii2vc.lib +..\dii2vbas.dll

to create a link library from my OW 1.9 created Win32 DLL.
Now this link library used to work fine for VC++ 6 and 2003
several years ago. However, I just retested the functionality
for the first time in several years and am getting a strange
error in the VC++ 2005 debugger:

Run-Time Check Failure #0 - The value of ESP was not properly
saved across a function call. This is usually a result of
calling a function declared with one calling convention with
a function pointer declared with a different calling convention.

The problem is occuring when I call a function in my DLL from
my VC++ code.

Does anyone know how to get rid of this problem ? I can go
much deeper into how the Win32 DLL was created. Basically it
is a VB / VBA / VC++ callable DLL.

BTW, to create the OW Win32 DLL, I use in the DLL (this is
condensed from the .h and .c files):

#ifdef __cplusplus
extern "C" {
#endif

#define CREATING_DLL

#ifdef CREATING_DLL
#define VBENTRY __declspec(dllexport) __stdcall
#else
#define VBENTRY __declspec(dllimport) __stdcall
#endif

void VBENTRY InitMyProg (char *inputFile, char *outputFile,
HWND ScreenOutputWindow);

#ifdef __cplusplus
};
#endif

Thanks,
Lynn
Lynn McGuire
2011-04-13 20:58:53 UTC
Permalink
Raw Message
Post by Lynn McGuire
Hi,
I am using Open Watcom C++ 1.9 in my app
wlib /fa dii2vc.lib +..\dii2vbas.dll
to create a link library from my OW 1.9 created Win32 DLL.
Now this link library used to work fine for VC++ 6 and 2003
several years ago. However, I just retested the functionality
for the first time in several years and am getting a strange
Run-Time Check Failure #0 - The value of ESP was not properly
saved across a function call. This is usually a result of
calling a function declared with one calling convention with
a function pointer declared with a different calling convention.
The problem is occuring when I call a function in my DLL from
my VC++ code.
Does anyone know how to get rid of this problem ? I can go
much deeper into how the Win32 DLL was created. Basically it
is a VB / VBA / VC++ callable DLL.
BTW, to create the OW Win32 DLL, I use in the DLL (this is
#ifdef __cplusplus
extern "C" {
#endif
#define CREATING_DLL
#ifdef CREATING_DLL
#define VBENTRY __declspec(dllexport) __stdcall
#else
#define VBENTRY __declspec(dllimport) __stdcall
#endif
void VBENTRY InitMyProg (char *inputFile, char *outputFile,
HWND ScreenOutputWindow);
#ifdef __cplusplus
};
#endif
Thanks,
Lynn
I figured out the problem after MUCH experimentation. The
linker file was getting corrupted unless I used a new file.

rem must use the /n to create a new library file or else the
rem visual C++ linker will get confused
wlib /n /fa dii2vc.lib +..\dii2vbas.dll

Lynn

Loading...