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

Re: [TRNSYS-users] functions get.. type char



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エm 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エt 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    山口 芳弘  
  yamaguti@alpha-net.ne.jp
=====================================

Attachment: setting.PNG
Description: PNG image