[TRNSYS-users] TR: trnsys.h problem with storage functions

keilholz, werner werner.keilholz at cstb.fr
Tue Mar 9 06:56:05 PST 2010


Salut Rémi, 

 

The _mp_ prefixes are not really required, and I think they are not defined for all functions in the standard TrnDll. 

To use these functions from C, you can directly declare the function with the name exported with the 

!DEC$ATTRIBUTES DLLEXPORT attribute in the FORTRAN source. Due to FORTRAN conventions, the name given is in capital letters, so 

SETSTORAGEVARS could do the trick in your case (instead of TRNSYSFUNCTIONS_mp_SETSTORAGEVARS).

 

I use the free tool from http://www.dependencywalker.com/ <http://www.dependencywalker.com/>   on TRNDll.dll to find out.

 

The real question, as I may have mentioned before, is: why would anyone who programs in C want to use these functions?

They were introduced 20 years ago for FORTRAN programmers to mimic static arrays. I think you're in for much less trouble if you declare local, static arrays in your DLL and handle storage by yourself... 

 

Werner

 

De : PERRIER Rémi 226004 [mailto:remi.perrier at cea.fr] 
Envoyé : mardi 9 mars 2010 15:09
À : trnsys-users at cae.wisc.edu
Objet : [TRNSYS-users] TR: trnsys.h problem with storage functions

 

Hi,

 

I've read some posts talking about the missing storage functions in the trnsys.h file, I tried to add them manually, writing :

 

extern "C" __declspec(dllimport) void   _cdecl TRNSYSFUNCTIONS_mp_SETSTORAGEVARS(double[],int,int[]);

extern "C" __declspec(dllimport) void   _cdecl TRNSYSFUNCTIONS_mp_SETSTORAGESIZE(int,int[]);

extern "C" __declspec(dllimport) void   _cdecl TRNSYSFUNCTIONS_mp_GETSTORAGEVARS(double[],int,int[]);

 

in the "Functions to access TRNSYS global variables" and :

 

#define setStorageVars                  TRNSYSFUNCTIONS_mp_SETSTORAGEVARS

#define setStorageSize                  TRNSYSFUNCTIONS_mp_SETSTORAGESIZE

#define getStorageVars                  TRNSYSFUNCTIONS_mp_GETSTORAGEVARS

 

In the "Short aliases for functions included in module TrnsysFunctions + lowercase variants of kernel routines" part of the trnsys.h file.

But I still get this error message :

 

1>type896.obj : error LNK2019: symbole externe non résolu __imp__TRNSYSFUNCTIONS_mp_SETSTORAGEVARS référencé dans la fonction _TYPE896

1>C:\Program Files\Trnsys16\UserLib\DebugDLLs\Type896Lib.dll : fatal error LNK1120: 1 externes non résolus

 

Do you have any idea of how I could access to those storage functions ?

 

Rémi PERRIER

 

 

CEA INES

Laboratoire DTS / LETh

Bâtiment PUMA 3, P112

BP 332 - 50, avenue du Lac Léman - 73377 Le Bourget du Lac  FRANCE

Tel : +33 (0)4 79 44 46 49

Mobile : +33 (0)6 76 95 91 86

Email : remi.perrier at cea.fr <mailto:remi.perrier at cea.fr> 

 

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.onebuilding.org/pipermail/trnsys-users-onebuilding.org/attachments/20100309/0f291dcf/attachment-0001.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: image/jpeg
Size: 2236 bytes
Desc: image001.jpg
URL: <http://lists.onebuilding.org/pipermail/trnsys-users-onebuilding.org/attachments/20100309/0f291dcf/attachment-0001.jpeg>


More information about the TRNSYS-users mailing list