calling .c from fortran

calling .c from fortran

Portrait de da1cj

I understand your replies.

However I transformed the tip as such that if I can basically extract the data from .c and then pass it to a fortran subroutine which can thus be called up from any other fortran programm.

I guess that was going to get me to my aim,which is to use the data in .c by calling it from Fortran, which I guess you probably missunderstood because of my inexplicit explanation.

Nevertheless, I tried the following below,... it compiled the fortran subroutine sure without error but in trying to build an exe it gave out 2 Erroes

unresolved external _MAIN
unresolved external _EXTRACT

I have tried to correct this error with little success.

main()
{
f1 (AZLNames);
return;
}

void extract (struct AZNames* a, int* ix, int* Number, char* Name, char* Unit, i
nt* Typ)
{
*Number = a[*ix-1].Number;
strcpy(Name, a[*ix-1].Name);
strcpy(Unit, a[*ix-1].Unit);
*Typ = a[*ix-1].Typ;
}

C ------ Fortan subroutine ------
subroutine f1(a)
character*80 a

character*80 name, unit
integer*4 number, typ, ix

ix = 2
call extract(a, ix, number, name, unit, typ)
print *, number, name, unit, typ
return
end

...can possibly someone help out to get me out of this error or basically something new to get me to the goal of being able to use the data in the struct form from .c calling it from fortran 90 such that if I give in the Number I should recieve thecorresponding Name, Unit and Type.


Pls: see my earlier posts to this topic

1 contribution / 0 nouveau(x)
Reportez-vous à notre Notice d'optimisation pour plus d'informations sur les choix et l'optimisation des performances dans les produits logiciels Intel.