Error when calling c++ dll from delphi

I am trying to use create a c++ wrapper (using MSVS2013) for some fortran code. The wrapper is supposed to be called from DELPHI (old code created in DELPHI 5 - which I cannot touch). (DELPHI -> C++ dll -> fortran dll)
The aim is that some data

struct

s (

record

in delphi) with

int

's and

double

's and

double[]

's are passed from delphi to fortran for calculations.
The c++ dll -> fortran is no problem - that I have tested with another c++ executable. It works. The problem is when delphi calls c++ and c++ calls fortran. Then I get an error that says

EDIT:
OK.. so I have managed to narrow it down:
I have division by zero that results in infinity (which is a correct internal result with the given input - this is not direct output from fortran dll).
This goes well when being called by c++ but not from delphi when the fortran dll is compiled using default release settings.
However it does work when using debug settings, both in c++ and delphi.
I output variables to a text file (before and after division) for verification and in all 4 cases the divisor is 0 and the result is 'inf' in the three cases that goes well. Both in debug and release mode I have the same setting for floating point exception handling "Produce NaN, signed infinities, and denormal results".

This turns out to be more of a compiler setting/flag problem than coding...

Anyone have any experience with this??
(I am working on a small and verifiable code piece)