[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [TRNSYS-users] New Module with External File



David and Yoshihiro,

Thank you for your response.
I tried to use the function getLUFileName, but finished in failure.

Because the function, getLUFileName is not implemented in TRNDLL.dll, I have to
rebuild TRNDLL.dll.

I added to "TRNSYS.h" the following 2 lines;
extern "C" __declspec(dllimport) char* _cdecl TRNSYSFUNCTIONS_mp_GETLUFILENAME(int LU);
#define getLUFileName TRNSYSFUNCTIONS_mp_GETLUFILENAME

And I added the code that David wrote to "TrnsysFunctions.f90".
Finally, I builded TRNDLL.dll using CVF 6.6B and I suceeded building TRNDLL.dll
and the TYPE using the function.

But when I tried to run the project, an access vioration occured in DFORRT.dll
and the TRNSYS project was terminated.

Best regards,
Ken Hatakeyama

>Yoshihiro,
>   I had not thought about the problem of accessing a file from a C++ DLL 
>that has already been opened by the Fortran DLL. I will discuss whether 
>there are any ways that the process can be made possible.
>Cheers,
>  David
>
>At 10:12 11/22/2006, Yoshihiro Yamaguchi wrote:
>>David,
>>
>>Thank you for your reply.
>>
>>I see, it is possible to get a fullpath name with calling getLUFileName.
>>
>>I don't know whether the recent TRNSYS can be applicable,
>>there was a problem when I tried to access an external file in C/C++.
>>Since TRNSYS opens all assigned files for start-up, TYPE written in
>>C/C++ could not access the assigned file. I knew the easy solution is
>>adding a FORTRAN function for closing file, and call it from C/C++.
>>But, this is not a smart.
>>
>>Yoshihiro
>>