This is my first attempt at library assembly, so please have mercy!

I am trying to link an external library (written in .f90 and compiled with IVF on VS2012) to my Qt application (32bit based on Qt 5.5.0- MinGW 4.9.2).

I have a few questions:

1) Is this futile? Some of the research I have found suggests that IVF and MinGW are ABI incompatible. I really want to stay with the MinGW compiler in Qt because basically everything else we are doing with the software uses this.

2) It would be of advantage to be able to load the library only when called upon (which would only represent a fraction of cases). For this reason I have been attempting to use QLibrary but keep getting Segmentation faults when I try to call SUBROUTINES defined in my DLL (with resolve("my_function")):

I have defined my external subroutine as (just a simple test at this stage, not actually important for what I wanted to do!)
Although the actual code I need to access is much more complicated (baby steps!), I wrote a simple subroutine to return the square of an integer:
Qt Code:
  1. SUBROUTINE SQ(a,asquare)
  3. integer, intent(in) :: a ! input
  4. integer, intent(out) :: asquare ! output
  5. asquare = a**2
To copy to clipboard, switch view to plain text mode 
I import the library and call it within Qt with:
Qt Code:
  1. typedef int (*MyPrototype)(int i);
  2. MyPrototype Square = (MyPrototype) FAST.resolve("SQ");
  3. int K = 4;
  4. int J = Square(K);
To copy to clipboard, switch view to plain text mode 
This results in a segregation error

3) Is there any way to check if the library has, in fact, loaded? Of course calling a subroutine would accomplish this, but that isn't working, and when I import the library DLLname.load() returns a positive result. and resolve.("sub_name") has a memoryaddress allocated to it. Does this suggest a type fault? Ie. passing the wrong identifier in to the fortran code.

Once again, thanks for reading and please feel free to take apart any flaws in logic I have, I'm not a programmer!