Return-Path: Delivered-To: apmail-ws-axis-c-user-archive@www.apache.org Received: (qmail 2706 invoked from network); 9 Feb 2007 11:37:55 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 9 Feb 2007 11:37:55 -0000 Received: (qmail 94992 invoked by uid 500); 9 Feb 2007 11:38:02 -0000 Delivered-To: apmail-ws-axis-c-user-archive@ws.apache.org Received: (qmail 94977 invoked by uid 500); 9 Feb 2007 11:38:02 -0000 Mailing-List: contact axis-c-user-help@ws.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: List-Post: List-Id: "Apache AXIS C User List" Reply-To: "Apache AXIS C User List" Delivered-To: mailing list axis-c-user@ws.apache.org Received: (qmail 94965 invoked by uid 99); 9 Feb 2007 11:38:02 -0000 Received: from herse.apache.org (HELO herse.apache.org) (140.211.11.133) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 09 Feb 2007 03:38:02 -0800 X-ASF-Spam-Status: No, hits=2.2 required=10.0 tests=HTML_MESSAGE,MIME_BOUND_NEXTPART X-Spam-Check-By: apache.org Received-SPF: pass (herse.apache.org: local policy) Received: from [193.126.233.113] (HELO sicpd01mr01.pararede.com) (193.126.233.113) by apache.org (qpsmtpd/0.29) with SMTP; Fri, 09 Feb 2007 03:37:52 -0800 X-MimeOLE: Produced By Microsoft Exchange V6.5 Content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="----=_NextPartTM-000-df6729a1-50aa-485e-8a0a-b3aa5ded4c18" Subject: Invalid access to memory location Date: Fri, 9 Feb 2007 11:33:51 -0000 Message-ID: <716CAD1CA091914D9F9489398A8AE8550659AC@mail01.pararede.int> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: Invalid access to memory location Thread-Index: AcdMPiwGYmAvwH9jQmiLRQMe+k9rtg== From: "Tobias Schoofs" To: X-Virus-Checked: Checked by ClamAV on apache.org ------=_NextPartTM-000-df6729a1-50aa-485e-8a0a-b3aa5ded4c18 Content-Type: multipart/alternative; boundary="----_=_NextPart_001_01C74C3E.2C069EC4" ------_=_NextPart_001_01C74C3E.2C069EC4 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Hi, =20 we're facing strange problems with a dll using axis-c (1.6b) on win32 = machine. =20 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=3D'Invalid access to memory location. ' Error Code=3D'998' Load lib error=3D'' =20 The code of the dll is: =20 int __stdcall add(int pOne, int pTwo) { char *tst =3D NULL; Calculator *calc =3D NULL; // static memory overwrites the stack!!! int rc =3D 0; try { calc =3D new Calculator(); rc =3D calc->add(pOne, pTtwo); delete calc; =20 return rc; } catch (exception &e) { printf("exception in calclib: %s\n", e.what()); return -1; } } =20 Caller: =20 int main() { int rc =3D 0; int one =3D 10; int two =3D 35; try { rc =3D add(one, two); } catch (exception &e) { printf("Exception in calc: %s\n", e.what());=20 return -1; } =20 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; } } =20 The header for both: extern "C" int __stdcall add(int, int); =20 >From the makefile: calclib.obj: calclib.cpp Calculator.hpp cl -c /MD /DWIN32 -GX /Ic:\ts\axis\include calclib.cpp=20 =20 calc.obj: calc.cpp cl -c -GX /MD /DWIN32 \ calc.cpp =20 Calculator.obj: Calculator.cpp Calculator.hpp cl -c -GX /MD /DWIN32 /Ic:\ts\axis\include Calculator.cpp =20 calclib: calclib.obj Calculator.obj=20 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"=20 =20 Any ideas? =20 Tank you, =20 Tobias =20 ------_=_NextPart_001_01C74C3E.2C069EC4 Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable =0A= =0A= =0A= =0A=
Hi,
=0A=
 
=0A=
we're facing strange problems with a = dll using axis-c (1.6b) on win32 machine.
=0A=
 
=0A=
1) We built a simple exe using the = Calculator client class which works well.
=0A=
2) We built a dll version with = __stdcall convention which causes problems.
=0A=
- 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.)
=0A=
- we than built the dll with /MD = flag which resulted in the following error:
=0A=
exception in calclib: DLOPEN FAILED in loading parser library = Failed to load parser within server = engine:
          &n= bsp;      Error Message=3D'Invalid access to = memory = location.
'          = ;      Error = Code=3D'998'
         &nb= sp;       Load lib error=3D''
=0A=
 
=0A=
The code of the dll is:
=0A=
 
=0A=
int __stdcall add(int pOne, int = pTwo) {
  char *tst =3D NULL;
  Calculator *calc =3D = NULL; // static memory overwrites the stack!!!
  int rc =3D = 0;

  try {
    calc =3D new = Calculator();
=0A=
    rc =3D = calc->add(pOne, pTtwo);
    
delete = calc;    
    return rc;
  = } catch (exception &e) {
    printf("exception in = calclib: %s\n", e.what());
    return -1;
  = }
=0A=
}
=0A=
 
=0A=
Caller:
=0A=
 
=0A=
int main() {
  int rc = =3D 0;
  int one =3D 10;
  int two =3D 35;
  try = {
=0A=
    rc =3D = 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;
=0A=
  } else = {
    printf("Error: %d\n", rc);
    = return -1;
  }
}
=0A=
 
=0A=
The header for both:
=0A=
extern "C" int __stdcall = add(int, int);
=0A=
 
=0A=
From the makefile:
=0A=
calclib.obj: calclib.cpp = Calculator.hpp
 cl -c /MD /DWIN32 -GX = /Ic:\ts\axis\include calclib.cpp
=0A=
 
=0A=
calc.obj: calc.cpp
  cl -c -GX /MD = /DWIN32 \
  calc.cpp
=0A=
 
=0A=
Calculator.obj: Calculator.cpp = Calculator.hpp
  cl -c -GX /MD /DWIN32 = /Ic:\ts\axis\include Calculator.cpp
=0A=
 
=0A=
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"
=0A=
calc: calc.obj
 cl  /MD = \
  calclib.lib calc.obj = \
 /link /NODEFAULTLIB:"libc.lib"
=0A=
 
=0A=
Any ideas?
=0A=
 
=0A=
Tank you,
=0A=
 
=0A=
Tobias
=0A=
 
------_=_NextPart_001_01C74C3E.2C069EC4-- ------=_NextPartTM-000-df6729a1-50aa-485e-8a0a-b3aa5ded4c18 Content-Type: text/plain; charset=us-ascii --------------------------------------------------------------------- To unsubscribe, e-mail: axis-c-user-unsubscribe@ws.apache.org For additional commands, e-mail: axis-c-user-help@ws.apache.org ------=_NextPartTM-000-df6729a1-50aa-485e-8a0a-b3aa5ded4c18--