Skip to main content

Error calling DLL function in runtime 9

  • January 28, 2011
  • 4 replies
  • 0 views

[Migrated content. Thread originally posted on 28 January 2011]

Hi, i call a dll function using the format "myfunction@WINAPI". The function correctly does its work, but crashes when returns, with an error message of memory access violation. With previous runtimes the function worked correctly.

Other functions of the same dll works correctly, all called with the WINAPI calling convention. For debug purpose i tried calling other working functions with the wrong calling convention, say "__cdecl", obtaining the same anomalous behaviour: the function is called, it performs its work and crashes on return.

Is it possible that "myfunction" is not called with the correct calling convention even if specified with @WINAPI?(setting the environment variable fails as well)

4 replies

Stephen Hjerpe
  • Participating Frequently
  • January 28, 2011

[Migrated content. Thread originally posted on 28 January 2011]

Hi, i call a dll function using the format "myfunction@WINAPI". The function correctly does its work, but crashes when returns, with an error message of memory access violation. With previous runtimes the function worked correctly.

Other functions of the same dll works correctly, all called with the WINAPI calling convention. For debug purpose i tried calling other working functions with the wrong calling convention, say "__cdecl", obtaining the same anomalous behaviour: the function is called, it performs its work and crashes on return.

Is it possible that "myfunction" is not called with the correct calling convention even if specified with @WINAPI?(setting the environment variable fails as well)
Try executing using --a2n and see if that resolves this issue

[Migrated content. Thread originally posted on 28 January 2011]

Hi, i call a dll function using the format "myfunction@WINAPI". The function correctly does its work, but crashes when returns, with an error message of memory access violation. With previous runtimes the function worked correctly.

Other functions of the same dll works correctly, all called with the WINAPI calling convention. For debug purpose i tried calling other working functions with the wrong calling convention, say "__cdecl", obtaining the same anomalous behaviour: the function is called, it performs its work and crashes on return.

Is it possible that "myfunction" is not called with the correct calling convention even if specified with @WINAPI?(setting the environment variable fails as well)
Good morning, i just tried and this does not fix the issue. However it is a C dll, not a .NET one.

[Migrated content. Thread originally posted on 28 January 2011]

Hi, i call a dll function using the format "myfunction@WINAPI". The function correctly does its work, but crashes when returns, with an error message of memory access violation. With previous runtimes the function worked correctly.

Other functions of the same dll works correctly, all called with the WINAPI calling convention. For debug purpose i tried calling other working functions with the wrong calling convention, say "__cdecl", obtaining the same anomalous behaviour: the function is called, it performs its work and crashes on return.

Is it possible that "myfunction" is not called with the correct calling convention even if specified with @WINAPI?(setting the environment variable fails as well)
Have you changed your function lately?

It would be very helpful to see the declaration of the C function as well as how you invoke it from ACUCOBOL-GT along with the ACUCOBOL-GT data definitions.

[Migrated content. Thread originally posted on 28 January 2011]

Hi, i call a dll function using the format "myfunction@WINAPI". The function correctly does its work, but crashes when returns, with an error message of memory access violation. With previous runtimes the function worked correctly.

Other functions of the same dll works correctly, all called with the WINAPI calling convention. For debug purpose i tried calling other working functions with the wrong calling convention, say "__cdecl", obtaining the same anomalous behaviour: the function is called, it performs its work and crashes on return.

Is it possible that "myfunction" is not called with the correct calling convention even if specified with @WINAPI?(setting the environment variable fails as well)
I found the problem. I was not passing a request argument to the C function. Sorry but this is a 3rd party dll. Thank you for support.