Re: c-gateways, fortran-sources, VC 6 - how to?



emammendes@xxxxxxxxx wrote:
> Hello
>
> I am trying to link my fortran codes to matlab. I did that in the past
> but I don't remember what I did. I used f2c to translate the fortran
> sources to c codes. Then I downloaded lif2c and compiled it to
> vcf2c.lib=libf2c.lib (no problem here). I have added all *.h to proper
> matlab-include dir and libf2c.lib to mvsc60 dir (and to the linker
> option). The mex command was:
>
> mex translated_c_code.c gateway.c
>
> visual c linker complains that _wsle and io something are missing. But
> tehy are part of libf2c.lib!
>
> I have also tried to lcc. It compiled ok and run with nor argumenst
> (showing that I need to enter some values just as I expected). But when
> I try with some arguments, "matlab blue screen of death comes out "
>
> Stack Trace:
> [0] CRTDLL.DLL:0x73da15ce(0xfc705d55, 0x01e6b4bd, 0x01e6b4bc, 16)
> [1] CRTDLL.DLL:0x73d9c15c(0x01e6b4bc, 0x01e68f08, 1632, 4)
> [2] plyap.dll:0x01e6672b(0x00dfd1d8, 0x00dfd1e0, 0x00dfd1f4,
> 0x00dfd1e8)
> [3] plyap.dll:0x01e62ecd(2, 0x00dfd5d0, 5, 0x00dfd6d4)
> [4] libmex.dll:_mexRunMexFile(2, 0x00dfd5d0, 5, 0x00dfd6d4) + 71
> bytes
> [5] m_interpreter.dll:void __cdecl inCallMexFunction(int,struct
> mxArray_tag * * const,int,struct mxArray_tag * * const,void
> (__cdecl*)(int,struct mxArray_tag * * const,int,struct mxArray_tag * *
> const),struct _mex_context *,struct mexfiles *)(2, 0x00dfd5d0, 5,
> 0x00dfd6d4) + 476 bytes
> [6] m_interpreter.dll:void __cdecl inRunMexFile(int,struct
> mxArray_tag * * const,int,struct mxArray_tag * * const,struct mexfiles
> *)(2, 0x00dfd5d0, 5, 0x00dfd6d4) + 126 bytes
> [7] m_interpreter.dll:void __cdecl inExecMexFile(int,int,struct
> mxArray_tag * * const,struct MATLAB_Function_tag *)(2, 5, 0x00dfd6d4,
> 0x01522880) + 82 bytes
> [8] m_interpreter.dll:_inExecFunction(2, 5, 0x00dfd6d4, 0x01522880) +
> 38 bytes
> [9] m_interpreter.dll:_inMMexExecute(556, 0x01522880, 2, 5) + 533
> bytes
> [10] m_interpreter.dll:enum opcodes __cdecl inMMex(char const
> *,int,int,int,int *,int *)(0x0145e514 "plyap", 556, 2, 5) + 94 bytes
> [11] m_interpreter.dll:int __cdecl inInterp(enum
> inDebugCheck,int,int,struct inPcodeNest_tag volatile *)(2, 0, 0,
> 0x01403d30) + 2143 bytes
> [12] m_interpreter.dll:_inInterPcode(2, 0x00dfdc54, 0, 0) + 193 bytes
> [13] m_interpreter.dll:enum inExecutionStatus __cdecl
> in_local_call_eval_function(int *,struct _m_parser_interface *,struct
> _pcodeheader *,int *,struct mxArray_tag * * const,enum inDebugCheck)(0,
> 0x7a87fa78, 0x00dfdc54, 0x00dfdcf8) + 174 bytes
> [14] m_interpreter.dll:_inEvalStringWithIsVarFcn(0x01ad6b38
> "[tau,S]=plyap(y,5,[],100,0.002);..", 33, 0, 0) + 531 bytes
> [15] m_interpreter.dll:_inEvalString(0x01ad6b38
> "[tau,S]=plyap(y,5,[],100,0.002);..", 33, 0, 0) + 50 bytes
> [16] m_interpreter.dll:enum inExecutionStatus __cdecl
> inEvalCmdWithLocalReturnandtype(char const *,int *,enum
> inDebugCheck)(0x01ad6b38 "[tau,S]=plyap(y,5,[],100,0.002);..", 0, 2,
> 0x00dfde30) + 68 bytes
> [17] m_interpreter.dll:_inEvalCmdNoEnd(0x01ad6b38
> "[tau,S]=plyap(y,5,[],100,0.002);..", 1, 0x0047f617, 11) + 16 bytes
> [18] matlab.exe:_mnParser(0x0116df4c, 271244, 0, 48) + 1001 bytes
> [19] matlab.exe:_WinMain@16(0x00400000 "MZ?", 0, 271244, 1) + 3872
> bytes
> [20] matlab.exe:_WinMainCRTStartup(0x0116df4c, 24, 0x7ffd7000,
> 0x8054a938) + 308 bytes
> [21] kernel32.dll:0x7c816d4f(0x0047172c, 0, 200, 457)
>
> I have linked to source codes with libf2c.lib (compiled with Visual C
> 6) and that could be the problem. I didn't figure out how to compile
> lif2c with lcc that comes with matlab.
>
> Any suggestions?
>
> Many thanks
>
> Ed
>

why not just write a fortran MEXFUNCTION?
.



Relevant Pages

  • Re: fortran iv using fortran 90 compiler
    ... quite a bit of Fortran 66 syntax. ... If you care to send me the Fortran 66 codes, ... to try to compile them with the free Salford compiler shown above. ...
    (comp.lang.fortran)
  • c-gateways, fortran-sources, VC 6 - how to?
    ... I am trying to link my fortran codes to matlab. ... I didn't figure out how to compile ...
    (comp.soft-sys.matlab)
  • Re: fortran files compile in matlab
    ... To compile fortran files in Matlab is not so simple ... ...
    (comp.soft-sys.matlab)
  • Re: Fortran 90 MAT FIle I/O module
    ... >>Rather new to fortran 90. ... >>MAT File I/O library in C. Alas, I have limited access to fortran ... I have gotten some of it to compile with ... It's not off-topic as it is specifically about Matlab MAT files. ...
    (comp.soft-sys.matlab)
  • Re: Fortran 90 MAT FIle I/O module
    ... make a few modifications here or there and get the code to compile and interface with C. So, I've decided to write a module to interface to my MAT File I/O library in C. Alas, I have limited access to fortran compilers/knowledge. ... I have gotten some of it to compile with gfortran/ifort on linux. ... I have in the past removed the runtime/dl-malloc.c and main.c modules from thelibrary which seems to work for C calling a fortran module, but I'm skeptical about the other way around. ... It's not off-topic as it is specifically about Matlab MAT files. ...
    (comp.soft-sys.matlab)

Loading