Dear Juan Crespo,
normally I don't answer questions concerning Matlab because I have no experience with it. But your question was waiting a long time and had to do something with DLL I decided to look at it.
Your C code has a serious error. You are declaring a variabale named "in1" as "double *". You do not set this pointer to point to a variable. Then you use this uninitialized pointer in the fscanf function to read in from the file. The value is written somewhere in the address space at a place where "in1" is pointing randomly. This will cause an error or crash.
Declare "in1" as "double" like you have declared "out". You must change some other places where you have used "in1".
Waldemar writing from Germany
Waldemar
Using 7.1.1, 8.5.1, 8.6.1, 2009 on XP and RT
Don't forget to give Kudos to good answers and/or questions