Temeshwarrior
Programmer
Hello com,
im sped a lot of time with interfaing a C-Function which looks quite like this:
Well, i tried to write an interface, but i does not realy work (SEQFAULTS)
And here is the Fortran structure in myStruct.inc:
And here the C-structure in myStruct.h:
Accessing the str-attribute in Fortran directly works but not via the C-function.
Is there any way to handle this?
Best,
Temeshwarrior
im sped a lot of time with interfaing a C-Function which looks quite like this:
Code:
include "myStruct.h"
char* GetCStr(struct myStruct *myS) {
myS->str = (char*)calloc(10,sizeof(char));
//do some other stuff like strcpy
return myS->str;
}
Well, i tried to write an interface, but i does not realy work (SEQFAULTS)
Code:
Interface
Function GetCStr(myS) bind( c )
#include "myStruct.inc"
Character, Pointer :: GetCStr
Record /myStruct/ myS
End Function GetCStr
End Interface
And here is the Fortran structure in myStruct.inc:
Code:
Structure /myStruct/
Character, Pointer :: str
End Structure
And here the C-structure in myStruct.h:
Code:
struct myStruct {
char* str;
};
Accessing the str-attribute in Fortran directly works but not via the C-function.
Is there any way to handle this?
Best,
Temeshwarrior