Re: Run-time check #4 from VC in VS2005



"Dave Moran" <dmoran@xxxxxxxxxxxxx> wrote in message
news:C45F7769-7248-4F8C-BD3D-69F325193654@xxxxxxxxxxxxxxxx
> I'm trying to build an argument list to dynamically call Fortran
> subroutines
> in legacy DLLs from VS2005. I use _alloca to build an array of pointers on
> the stack, to allow the data to be passed by reference. Having created the
> references on the stack, I use inline assembler to call the actual
> subroutine. When I try to exit my calling function I get an RTC #4. The
> guard
> look to be intact, but something is obviously very wrong because the
> program
> crashes shortly afterwards in my c# code.
> ...
> // func is obtained through LoadLibrary and GetProcAddress
> __asm
> {
> call func
> }
>
> // Bang...

Nine times out of ten the error results from a mismatch in calling
conventions. You don't show that code.

How do you define your function pointer? Show that and the Fortran
declaration as well. Do you know if Fortran uses the "standard" calling
convention where the callee pops the arguments off the stack?

Regards,
Will


.



Relevant Pages

  • Re: Stack corruption and memory leak problems in c++/Fortran application
    ... compiler FORTRAN:Intel Fortran Compiler 9.1 ... version and seeing what the call stack looks like when the app crashes? ... I tried with debug, when it crash each time it show me error on ... you're calling with the parameters you think you're calling with. ...
    (comp.lang.fortran)
  • Re: Stack corruption and memory leak problems in c++/Fortran application
    ... There are some thousands of files including FORTRAN and C++ code. ... It could just be that the stack is too small. ... compiler FORTRAN:Intel Fortran Compiler 9.1 ... Calling between Fortran and C ...
    (comp.lang.fortran)
  • Re: Fortran memory allocation (stack/heap) issues
    ... > rather than Fortran, ... dynamic allocation, and relatively little stack allocation. ... value return and arrays by reference. ...
    (comp.lang.fortran)
  • Re: Program organization
    ... There is a lot of good and useful advice in both editions, even though Steve McConnell has a decidedly negative view of Fortran in the 1st edition and the examples in the 2nd edition are heavily oriented toward the Microsoft Visual Studio languages. ... and all other files define one of the subroutines. ... Modular decomposition is a very powerful and effective practice in software engineering. ... You talk about two separate issues here, global data and source code file organization. ...
    (comp.lang.fortran)
  • Re: Strange Fortran version
    ... "ENTRY lable" was common in some Fortran IV subroutines and probably ... Fortran compilers (many were written as a higher exercise in M.SC tasks ...
    (comp.lang.fortran)