Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
29389 Discussions

VC++&Fortran mixed-language string problem

owenkid
Beginner
3,010 Views

I posted an early thread this morning, using the C#&Fortran.

But no one give me even a single answer, so I switch to VC++&Fortran(DLL).

But I encounter the same problem:Unhandled exception at 0x10001082 in MFCMainTest.exe: 0xC0000005: Access violation reading location 0x00000007.

Then I switch to so I switch to VC++&Fortran(Static library),then I got another problem:Error1error LNK2019: unresolved external symbol _TEST@12 referenced in function _dynamicLIBSTRING_Cbridge.obj

I put the whole code in the attachment, I hope some guys can get me out of here.

0 Kudos
22 Replies
sumi714
Beginner
412 Views

That certainly did the trick! I actually tried dummy character string earlier and that didn't work. I suppose, "reference" attribute to the function made the difference. I did find this attribute in the help and applied before. Obviously, that attempt was not proper and hence didn't work.

As all attempt failed, I thought of accepting the character string as pointer in FORTRAN routine.

Thank you very much, Steve.

0 Kudos
Steven_L_Intel1
Employee
412 Views
There's a handy table in the mixed-language programming chapter of the on-disk documentation that spells out how arguments of various types are passed when the different attributes are used. When you say C without REFERENCE, character arguments are passed/accepted as a single character. Why? Because this is the way MS did it in Fortran PowerStation. It is a rather useless choice.
0 Kudos
Reply