Hi Tobias,
You must use the /MD flag when building any application or DLL
that will use the Axis code. Given that everything is built with the /MD
flag, everything will work fine. If you get a DLOPEN FAILED error when
loading the parser library this must be because you have either changed
the PATH environment variable, moved a 'dependent' library or altered the
contents of axiscpp.conf file. You may also need to check that the xerces
and parser DLLs are both on the path. I'm not quite sure what you are
referring to when you say in item 2 that "We built a dll version with
__stdcall convention which causes problems.". Have you changed something
inside the axis build? If you modify the calling convention for any
method/function within axis, you are almost certain to run into problems.
Have you tried turning on trace to see if that gives you any additional
information?
Regards,
Fred Preston.
"Tobias Schoofs" <[EMAIL PROTECTED]>
09/02/2007 11:33
Please respond to
"Apache AXIS C User List" <[email protected]>
To
<[email protected]>
cc
Subject
Invalid access to memory location
Hi,
we're facing strange problems with a dll using axis-c (1.6b) on win32
machine.
1) We built a simple exe using the Calculator client class which works
well.
2) We built a dll version with __stdcall convention which causes problems.
- We first built the dll without the /MD compiler flag. It worked but with
strange effects. (Memory was overwritten during the instantiation of the
Calculator class.)
- we than built the dll with /MD flag which resulted in the following
error:
exception in calclib: DLOPEN FAILED in loading parser library Failed to
load parser within server engine:
Error Message='Invalid access to memory location.
' Error Code='998'
Load lib error=''
The code of the dll is:
int __stdcall add(int pOne, int pTwo) {
char *tst = NULL;
Calculator *calc = NULL; // static memory overwrites the stack!!!
int rc = 0;
try {
calc = new Calculator();
rc = calc->add(pOne, pTtwo);
delete calc;
return rc;
} catch (exception &e) {
printf("exception in calclib: %s\n", e.what());
return -1;
}
}
Caller:
int main() {
int rc = 0;
int one = 10;
int two = 35;
try {
rc = add(one, two);
} catch (exception &e) {
printf("Exception in calc: %s\n", e.what());
return -1;
}
if (rc > 0) { // it's just a simple test, so we're using values > 0 only
printf("Result: %d\n", rc);
return 0;
} else {
printf("Error: %d\n", rc);
return -1;
}
}
The header for both:
extern "C" int __stdcall add(int, int);
>From the makefile:
calclib.obj: calclib.cpp Calculator.hpp
cl -c /MD /DWIN32 -GX /Ic:\ts\axis\include calclib.cpp
calc.obj: calc.cpp
cl -c -GX /MD /DWIN32 \
calc.cpp
Calculator.obj: Calculator.cpp Calculator.hpp
cl -c -GX /MD /DWIN32 /Ic:\ts\axis\include Calculator.cpp
calclib: calclib.obj Calculator.obj
cl /LD /MD calclib.obj \
Calculator.obj \
c:\\ts\\axis\\lib\\axis\\axis_client.lib \
/link /EXPORT:add \
/NODEFAULTLIB:"libc.lib"
calc: calc.obj
cl /MD \
calclib.lib calc.obj \
/link /NODEFAULTLIB:"libc.lib"
Any ideas?
Tank you,
Tobias
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
Unless stated otherwise above:
IBM United Kingdom Limited - Registered in England and Wales with number
741598.
Registered office: PO Box 41, North Harbour, Portsmouth, Hampshire PO6 3AU