From: Yoshihiro Yamaguchi <yamaguti@alpha-net.ne.jp>
To: "javier mota" <fjmi_3i@hotmail.com>, trnsys-users@engr.wisc.edu
Subject: Re: [TRNSYS-users] functions get.. type char
Date: Wed, 10 Aug 2005 17:59:08 +0900
Dear Javier,
I am trying to write trnsys16 components in C++.
But, there are a few problem, as far as I see.
In your case, I think C++ runtime library, which is linked with
your DLL, is inconsistent with that of trnlib.dll.
Try to do followings,
- Recompile trnlib.dll with release mode.
(The problem in debug mode is trnlib.dll is linking both msvcrt.dll
and msvcrtd.dll. It is not good. I could not fix the conflict for now.)
- In your DLL project, change the compile option like the attached png
file. ( you don't care where it is release or debug mode ).
It worked at least in my environment.
Good luck.
Yoshihiro
> Dear all:
> I?Gm Javier mota from 3i, Madrid;once more.
> I have a problem with the functions getwhich returns a character type
like
> (e.g. getDeckFileName).
> I am using trnsys16 and I would like use this functions in c++
>
> I have among other lines in Trnsys.h
>
> extern "C" __declspec(dllimport) char*_cdecl
> TRNSYSFUNCTIONS_mp_GETDECKFILENAME(void);
> and
> #define getDeckFileName TRNSYSFUNCTIONS_mp_GETDECKFILENAME
>
> and in TRNSYSFUNCTIONS.f90 something like
>
> function getTrnsysInputFileDir()
> !dec$ attributes dllexport, c, reference, nomixed_str_len_arg ::
> getTrnsysInputFileDir
> !dec$ attributes alias:"TRNSYSFUNCTIONS_mp_GETTRNSYSINPUTFILEDIR",
> decorate :: getTrnsysInputFileDir
> use TrnsysData
> character (len=maxPathLength) :: getTrnsysInputFileDir
> getTrnsysInputFileDir = TrnsysInputFileDir
> end function getTrnsysInputFileDir
>
> so I write in my program:
> char *gg;
> gg= getTrnsysInputFileDir();
>
>
> I don?Gt have problem in making dll but when I run the program in trnys
I get
> an access violation error
> You mus be sure I would like solve this problem,
> Thank you
=====================================
Yoshihiro Yamaguchi ?R?û?@?F?O
yamaguti@alpha-net.ne.jp
=====================================
<< setting.PNG >>