Archived OpenModelica forums. Posting is disabled.

Alternative forums include GitHub discussions or StackOverflow (make sure to read the Stack Overflow rules; you need to have well-formed questions)


Forgot password? | Forgot username? | Register

Some warnings form the compiller

Some warnings form the compiller

Hi I have the following function that I want to evaluate :

Code:


function getValue
  import Modelica.Utilities.*;
  input String line;
  input Integer indexToken=1;
  output Real tokenValue=0;
  output Integer nextToken;
protected
  Types.TokenValue token;
algorithm
  (token,nextToken):=Strings.scanToken(line,indexToken);
  if token.tokenType==Types.TokenType.DelimiterToken then
    (token,nextToken):=Strings.scanToken(line,nextToken);
    end if;
  if token.tokenType==Types.TokenType.RealToken then
      tokenValue:=token.real;
    end if;
    if token.tokenType==Types.TokenType.IntegerToken then
      tokenValue:=token.integer;
  end if;
end getValue; 

and I am evaliating with OMNotebook like this:

Code:


getValue("235.15,1.013e5,4.18");
getValue("235.15,1.013e5,4.18",7)

And at the evaluation of the function I get an omc error which is a linker warning. Why this is happening?
(235.15,7)
(101300.0,15)
OMC-ERROR:
"Error: Error building simulator. Buildlog: OPENMODELICAHOME = C:\OpenModelica1.8.0
MINGW = C:\OpenModelica1.8.0\MinGW
gcc -I"C:/OpenModelica1.8.0/include/omc"  -O0 -falign-functions -msse2 -mfpmath=sse  -c -o Modelica_Utilities_Strings_length.o Modelica_Utilities_Strings_length.c
gcc -I"C:/OpenModelica1.8.0/include/omc"  -O0 -falign-functions -msse2 -mfpmath=sse  -c -o Modelica_Utilities_Strings_length_records.o Modelica_Utilities_Strings_length_records.c
g++ -shared -export-dynamic -o Modelica_Utilities_Strings_length.dll Modelica_Utilities_Strings_length.o Modelica_Utilities_Strings_length_records.o -lModelicaExternalC -I"C:/OpenModelica1.8.0/include/omc"  -O0 -falign-functions -msse2 -mfpmath=sse  -L"C:/OpenModelica1.8.0/lib/omc" -lSimulationRuntimeC -lregex -lexpat -static-libgcc -lsendData -lQtNetwork-mingw -lQtCore-mingw -lQtGui-mingw -luuid -lole32 -lws2_32 -lm
c:/openmodelica1.8.0/mingw/bin/../lib/gcc/mingw32/4.4.0/../../../../mingw32/bin/ld.exe: warning: --export-dynamic is not supported for PE targets, did you mean --export-all-symbols?

Re: Some warnings form the compiller

Hi,

I think the real error message is not show here.
The problem is that we're evaluating functions by dynamic loading and the
first getValue call builds the .dll and loads it in the process, then the next
call tries to do that again and fails to generate the .dll because is already
loaded in the OMC process. So the correct error should be "permission denied".
With the latest omc this seems to work fine:

Code:


adrpo@ida-liu050 ~/dev/OpenModelica/build/bin/romar_ro
$ ../omc f.mos Modelica
true
""
(235.15,7)
(101300.0,15)
""

adrpo@ida-liu050 ~/dev/OpenModelica/build/bin/romar_ro
$ cat f.mos
loadFile("f.mo"); getErrorString();
getValue("235.15,1.013e5,4.18");
getValue("235.15,1.013e5,4.18",7);
getErrorString();

Get the latest nightly build here:
http://build.openmodelica.org/omc/build … ly-builds/

Cheers,
Adrian Pop/

There are 0 guests and 0 other users also viewing this topic
You are here: