Permalink
Browse files

added third test case, change makefile so that libftc is compiled wit…

…h umangled names
  • Loading branch information...
deltaluca committed Sep 13, 2011
1 parent 70b2a0f commit f32bfd8fa8cd338af0fa6770899f824e02393c8e
Showing with 54 additions and 1 deletion.
  1. +1 −1 Makefile
  2. +8 −0 ftc_file_io.h
  3. +9 −0 test/test3/Makefile
  4. +1 −0 test/test3/input.dat
  5. +16 −0 test/test3/main.c
  6. +16 −0 test/test3/main.f90
  7. +3 −0 test/test3/main.h
View
@@ -34,7 +34,7 @@ $(ODIR)/%.o: $(SDIR)/%.cpp
all: $(OBJ)
$(CC) -o $(_EXEC) $(OBJ) $(LFLAGS)
- g++ -c ftc_file_io.c
+ gcc -c ftc_file_io.c
ar -r libftc.a ftc_file_io.o
# ----------------------------------------
View
@@ -20,6 +20,14 @@
**/
+#ifdef __cplusplus
+extern "C" {
+#endif
+
void ftc__open_file(int id, const char* path);
FILE* ftc__get_file(int id);
void ftc__close_file(int id);
+
+#ifdef __cplusplus
+}
+#endif
View
@@ -0,0 +1,9 @@
+all:
+ ftc main.f90
+ gcc main.c -I. -I$(FTC) -o main $(FTC)/libftc.a
+ echo 10 > input.dat
+ ./main input.dat
+
+.PHONY: clean
+clean:
+ rm -f main.c main.h main
View
@@ -0,0 +1 @@
+10
View
@@ -0,0 +1,16 @@
+#include <ftc_file_io.h>
+#include <stdio.h>
+#include <math.h>
+#include <main.h>
+
+int main(int *argc,char* *argv)
+{
+ int __retv;
+ int value;
+ ftc__open_file(3,argv[1]);
+ fscanf(ftc__get_file(3),"%d\n",&value);
+ ftc__close_file(3);
+ printf("%s%d\n","value=",value);
+ __retv = 0;
+ return __retv;
+}
View
@@ -0,0 +1,16 @@
+integer(4) function main(argc, argv)
+
+ integer(4) :: argc
+ character(len=*), dimension(*) :: argv
+
+ integer(4) :: value
+
+ OPEN(3,file=argv(2))
+ READ (3,*) value
+ CLOSE(3)
+
+ print *, "value=",value
+
+ main = 0
+ return
+end
View
@@ -0,0 +1,3 @@
+#pragma once
+int main(int *argc,char* *argv)
+;

0 comments on commit f32bfd8

Please sign in to comment.