Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Missing ModelicaExternalC.dll in Modelica #2

Closed
jnangle opened this issue Jul 29, 2015 · 26 comments
Closed

Missing ModelicaExternalC.dll in Modelica #2

jnangle opened this issue Jul 29, 2015 · 26 comments

Comments

@jnangle
Copy link

jnangle commented Jul 29, 2015

I was excited to see this code available, however I get the following error when I load the Modelica code into Dymola and run a simulation on the XMLTest1 model:

The program can't start because ModelicaExternalC.dll is missing from your computer. Try reinstalling the program to fix this problem.

I can find ModelicaExternalC.lib, but not the dynamic library. Do I need to to change something in the ExternData code in order for it to look for the static library, not the dynamic library?

System specifics:
Windows 7 Enterprise SP1
Dymola 2015 and 2016 32-bit and 64-bit versions

@tbeu
Copy link
Contributor

tbeu commented Jul 29, 2015

The library should work out-of-the-box with Dymola. ModelicaExternalC.dll (and in fact all DLLs) is not required by Dymola. Only ED_XMLFile.lib and expat.lib from the library and ModelicaExternalC.lib from the Dymola installation are needed for linking an executable of XMLTest1.

@jnangle
Copy link
Author

jnangle commented Jul 29, 2015

That's what I thought should happen. However, I get the error message above when I use version 1.0.2 of ExternData.

@tbeu
Copy link
Contributor

tbeu commented Jul 29, 2015

Did you open package.mo in Dymola? What happens if you delete all DLLs from the Library dirs?

@tbeu
Copy link
Contributor

tbeu commented Jul 29, 2015

You must not use ExternData\Resources\thirdParty\ITI\win32\ModelicaExternalC.lib with Dymola. This is only for building the DLLs for SimulationX from ITI. Dymola provides its own ModelicaExternalC.lib.

@jnangle
Copy link
Author

jnangle commented Jul 29, 2015

Deleting all of the DLL files from the ExternData Library folders seems to have fixed the problem. The simulations run and I no longer get the error message. Thank you for your help and your quick responses.

@tbeu
Copy link
Contributor

tbeu commented Jul 29, 2015

Glad that it works for you. But strange, I thought I checked this. I'll try to reproduce it next week with Dymola 2015 and 2016. I'll leave this issue open meanwhile.

@tbeu tbeu removed the help wanted label Jul 29, 2015
@tbeu
Copy link
Contributor

tbeu commented Aug 4, 2015

Actually I cannot reproduce the problem you mentioned with Dymola 2016. I downloaded ExternData 1.0.2 from the releases, extracted it to an empty directory and opened package.mo in Dymola 2016. The example models work out of the box.

@thorade
Copy link
Contributor

thorade commented Aug 4, 2015

I can confirm this issue exists. Did a fresh clone, then tried to run XMLTest1 with Dymola 2016.

dymola_externdata

@tbeu
Copy link
Contributor

tbeu commented Aug 4, 2015

@thorade Thank you for reproducing the issue. If I only would know what goes wrong here? Do you have any clue (since you are an experienced Dymola user)?

@thorade
Copy link
Contributor

thorade commented Aug 4, 2015

I believe it might be related to another issue I once encountered:
ibpsa/modelica-ibpsa#40
If I manage to fix it, I will report a solution here.

@tbeu
Copy link
Contributor

tbeu commented Aug 4, 2015

Do you use MSVC or MinGW compiler? In my case it is MSVC.

@tbeu
Copy link
Contributor

tbeu commented Aug 4, 2015

In case of MSVC the linker option /VERBOSE:Lib displays a list of found lib dependencies.

@thorade
Copy link
Contributor

thorade commented Aug 4, 2015

I tried Visual Studio 2013 Community Edition, all examples have the same error.
The fix suggested by jnangle works:
After deleting all dll files from ExternData\ExternData\Resources\Library\win32 the examples simulate.
This also means that my first idea for a fix was wrong, must be something else.

Where would I specify the linker option and where can I find the output?

@tbeu
Copy link
Contributor

tbeu commented Aug 4, 2015

Please set /VERBOSE:Lib in file build.bat of your "Dymola 2016\bin" install directory. Edit line 197 from

set LINK=%DYMOLALINK% /stack:0x500000 /NODEFAULTLIB:LIBCD /NODEFAULTLIB:LIBC /NODEFAULTLIB:LIBCMT /OPT:NOREF  %liblink% %libdsLib% %DELAYARG1% %DELAYARG2% dymosim.obj %EXTRALIB% 

to

set LINK=%DYMOLALINK% /VERBOSE:Lib /stack:0x500000 /NODEFAULTLIB:LIBCD /NODEFAULTLIB:LIBC /NODEFAULTLIB:LIBCMT /OPT:NOREF  %liblink% %libdsLib% %DELAYARG1% %DELAYARG2% dymosim.obj %EXTRALIB% 

Please run the translation again and watch the output in the Dymola log.

@thorade
Copy link
Contributor

thorade commented Aug 4, 2015

OK, I changed that line and here is the complete content from the buildlog.txt:

Compiling and linking the model (Visual C++). 

dsmodel.c

Searching libraries
    Searching C:\Program Files (x86)\Windows Kits\8.1\lib\winv6.3\um\x86\user32.lib:
    Searching C:\Program Files (x86)\Windows Kits\8.1\lib\winv6.3\um\x86\advapi32.lib:
    Searching C:\Program Files (x86)\Windows Kits\8.1\lib\winv6.3\um\x86\comdlg32.lib:
    Searching C:\Program Files (x86)\Windows Kits\8.1\lib\winv6.3\um\x86\wsock32.lib:
    Searching C:\Program Files (x86)\Windows Kits\8.1\lib\winv6.3\um\x86\comctl32.lib:
    Searching C:\Program Files (x86)\Windows Kits\8.1\lib\winv6.3\um\x86\netapi32.lib:
    Searching C:\Program Files (x86)\Windows Kits\8.1\lib\winv6.3\um\x86\dnsapi.lib:
    Searching C:\Program Files (x86)\Windows Kits\8.1\lib\winv6.3\um\x86\wininet.lib:
    Searching C:\Program Files (x86)\Windows Kits\8.1\lib\winv6.3\um\x86\shell32.lib:
    Searching C:\Program Files (x86)\Windows Kits\8.1\lib\winv6.3\um\x86\gdi32.lib:
    Searching C:\Program Files (x86)\Windows Kits\8.1\lib\winv6.3\um\x86\ws2_32.lib:
    Searching C:\Program Files (x86)\Windows Kits\8.1\lib\winv6.3\um\x86\shlwapi.lib:
    Searching C:/Program Files (x86)/Dymola 2016\bin\lib\libds.lib:
    Searching C:\Program Files (x86)\Windows Kits\8.1\lib\winv6.3\um\x86\ole32.lib:
    Searching C:\Program Files (x86)\Windows Kits\8.1\lib\winv6.3\um\x86\OleAut32.lib:
    Searching C:\Program Files (x86)\Windows Kits\8.1\lib\winv6.3\um\x86\Wbemuuid.lib:
    Searching C:\Program Files (x86)\Windows Kits\8.1\lib\winv6.3\um\x86\Wintrust.lib:
    Searching C:\Program Files (x86)\Windows Kits\8.1\lib\winv6.3\um\x86\crypt32.lib:
    Searching C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\LIB\delayimp.lib:
    Searching C:/Users/mthorade/Documents/Dymola/ExternData/ExternData/Resources/Library/win32\ED_XMLFile.lib:
    Searching C:/Users/mthorade/Documents/Dymola/ExternData/ExternData/Resources/Library/win32\expat.lib:
    Searching C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\LIB\MSVCRT.lib:
    Searching C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\LIB\OLDNAMES.lib:
    Searching C:\Program Files (x86)\Windows Kits\8.1\lib\winv6.3\um\x86\uuid.lib:
    Searching C:\Program Files (x86)\Windows Kits\8.1\lib\winv6.3\um\x86\kernel32.lib:
    Searching C:\Program Files (x86)\Windows Kits\8.1\lib\winv6.3\um\x86\user32.lib:
    Searching C:\Program Files (x86)\Windows Kits\8.1\lib\winv6.3\um\x86\advapi32.lib:
    Searching C:\Program Files (x86)\Windows Kits\8.1\lib\winv6.3\um\x86\comdlg32.lib:
    Searching C:\Program Files (x86)\Windows Kits\8.1\lib\winv6.3\um\x86\wsock32.lib:
    Searching C:\Program Files (x86)\Windows Kits\8.1\lib\winv6.3\um\x86\comctl32.lib:
    Searching C:\Program Files (x86)\Windows Kits\8.1\lib\winv6.3\um\x86\netapi32.lib:
    Searching C:\Program Files (x86)\Windows Kits\8.1\lib\winv6.3\um\x86\dnsapi.lib:
    Searching C:\Program Files (x86)\Windows Kits\8.1\lib\winv6.3\um\x86\wininet.lib:
    Searching C:\Program Files (x86)\Windows Kits\8.1\lib\winv6.3\um\x86\shell32.lib:
    Searching C:\Program Files (x86)\Windows Kits\8.1\lib\winv6.3\um\x86\gdi32.lib:
    Searching C:\Program Files (x86)\Windows Kits\8.1\lib\winv6.3\um\x86\ws2_32.lib:
    Searching C:\Program Files (x86)\Windows Kits\8.1\lib\winv6.3\um\x86\shlwapi.lib:
    Searching C:/Program Files (x86)/Dymola 2016\bin\lib\libds.lib:
    Searching C:\Program Files (x86)\Windows Kits\8.1\lib\winv6.3\um\x86\ole32.lib:
    Searching C:\Program Files (x86)\Windows Kits\8.1\lib\winv6.3\um\x86\OleAut32.lib:
    Searching C:\Program Files (x86)\Windows Kits\8.1\lib\winv6.3\um\x86\Wbemuuid.lib:
    Searching C:\Program Files (x86)\Windows Kits\8.1\lib\winv6.3\um\x86\Wintrust.lib:
    Searching C:\Program Files (x86)\Windows Kits\8.1\lib\winv6.3\um\x86\crypt32.lib:
    Searching C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\LIB\delayimp.lib:
    Searching C:/Users/mthorade/Documents/Dymola/ExternData/ExternData/Resources/Library/win32\ED_XMLFile.lib:
    Searching C:/Users/mthorade/Documents/Dymola/ExternData/ExternData/Resources/Library/win32\expat.lib:
    Searching C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\LIB\MSVCRT.lib:
    Searching C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\LIB\OLDNAMES.lib:
    Searching C:\Program Files (x86)\Windows Kits\8.1\lib\winv6.3\um\x86\uuid.lib:
    Searching C:\Program Files (x86)\Windows Kits\8.1\lib\winv6.3\um\x86\kernel32.lib:
    Searching C:\Program Files (x86)\Windows Kits\8.1\lib\winv6.3\um\x86\user32.lib:
    Searching C:\Program Files (x86)\Windows Kits\8.1\lib\winv6.3\um\x86\advapi32.lib:
    Searching C:\Program Files (x86)\Windows Kits\8.1\lib\winv6.3\um\x86\comdlg32.lib:
    Searching C:\Program Files (x86)\Windows Kits\8.1\lib\winv6.3\um\x86\wsock32.lib:
    Searching C:\Program Files (x86)\Windows Kits\8.1\lib\winv6.3\um\x86\comctl32.lib:
    Searching C:\Program Files (x86)\Windows Kits\8.1\lib\winv6.3\um\x86\netapi32.lib:
    Searching C:\Program Files (x86)\Windows Kits\8.1\lib\winv6.3\um\x86\dnsapi.lib:
    Searching C:\Program Files (x86)\Windows Kits\8.1\lib\winv6.3\um\x86\wininet.lib:
    Searching C:\Program Files (x86)\Windows Kits\8.1\lib\winv6.3\um\x86\shell32.lib:
    Searching C:\Program Files (x86)\Windows Kits\8.1\lib\winv6.3\um\x86\gdi32.lib:
    Searching C:\Program Files (x86)\Windows Kits\8.1\lib\winv6.3\um\x86\ws2_32.lib:

Finished searching libraries
   Creating library dymosim.lib and object dymosim.exp

Searching libraries
    Searching C:\Program Files (x86)\Windows Kits\8.1\lib\winv6.3\um\x86\user32.lib:

Finished searching libraries

Searching libraries
    Searching C:\Program Files (x86)\Windows Kits\8.1\lib\winv6.3\um\x86\user32.lib:
    Searching C:\Program Files (x86)\Windows Kits\8.1\lib\winv6.3\um\x86\advapi32.lib:
    Searching C:\Program Files (x86)\Windows Kits\8.1\lib\winv6.3\um\x86\comdlg32.lib:
    Searching C:\Program Files (x86)\Windows Kits\8.1\lib\winv6.3\um\x86\wsock32.lib:
    Searching C:\Program Files (x86)\Windows Kits\8.1\lib\winv6.3\um\x86\comctl32.lib:
    Searching C:\Program Files (x86)\Windows Kits\8.1\lib\winv6.3\um\x86\netapi32.lib:
    Searching C:\Program Files (x86)\Windows Kits\8.1\lib\winv6.3\um\x86\dnsapi.lib:
    Searching C:\Program Files (x86)\Windows Kits\8.1\lib\winv6.3\um\x86\wininet.lib:
    Searching C:\Program Files (x86)\Windows Kits\8.1\lib\winv6.3\um\x86\shell32.lib:
    Searching C:\Program Files (x86)\Windows Kits\8.1\lib\winv6.3\um\x86\gdi32.lib:
    Searching C:\Program Files (x86)\Windows Kits\8.1\lib\winv6.3\um\x86\ws2_32.lib:
    Searching C:\Program Files (x86)\Windows Kits\8.1\lib\winv6.3\um\x86\shlwapi.lib:
    Searching C:/Program Files (x86)/Dymola 2016\bin\lib\libds.lib:
    Searching C:\Program Files (x86)\Windows Kits\8.1\lib\winv6.3\um\x86\ole32.lib:
    Searching C:\Program Files (x86)\Windows Kits\8.1\lib\winv6.3\um\x86\OleAut32.lib:
    Searching C:\Program Files (x86)\Windows Kits\8.1\lib\winv6.3\um\x86\Wbemuuid.lib:
    Searching C:\Program Files (x86)\Windows Kits\8.1\lib\winv6.3\um\x86\Wintrust.lib:
    Searching C:\Program Files (x86)\Windows Kits\8.1\lib\winv6.3\um\x86\crypt32.lib:
    Searching C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\LIB\delayimp.lib:
    Searching C:/Users/mthorade/Documents/Dymola/ExternData/ExternData/Resources/Library/win32\ED_XMLFile.lib:
    Searching C:/Users/mthorade/Documents/Dymola/ExternData/ExternData/Resources/Library/win32\expat.lib:
    Searching C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\LIB\MSVCRT.lib:

Finished searching libraries
LINK : warning LNK4199: /DELAYLOAD:ED_XMLFile.dll ignored; no imports found from ED_XMLFile.dll

Successful generation of Dymosim. 

@tbeu
Copy link
Contributor

tbeu commented Aug 4, 2015

Thanks. Looks OK though since ED_XMLFile.lib and expat.lib are linked as expected.

Need to check the linker warning about the imports. Oops!! This is the problem: ED_XMLFile.dll must not be there.

@thorade
Copy link
Contributor

thorade commented Aug 4, 2015

OK, I will do that.
As deleting the dlls from the Resources\Library\win32 directory seems to fix the problem, I would assume they are the problematic part!? Are they needed or would it be an option to deliver the library without dlls?

@tbeu
Copy link
Contributor

tbeu commented Aug 4, 2015

Yes, indeed. The link instruction (line 197 of build.bat) contains this DELAYLOAD: option. Since ED_XMLFile.dll and ED_XMLFile.lib have the same name this leads to the conflict.

The reason why there are both ED_XMLFile.dll and ED_XMLFile.lib in Resources\win32 is simple. This way the lib should work out-of-the-shelf with SimulationX and Dymola (on Win). SimulationX requires the DLL only and Dymola the LIB.

@tbeu
Copy link
Contributor

tbeu commented Aug 4, 2015

I'll rename ED_XMLFile.dll to ITI_ED_XMLFile.dll and will release a new version soon.

@thorade
Copy link
Contributor

thorade commented Aug 4, 2015

Dependecy Walker gives following warning for dymosim.exe:

Warning: At least one delay-load dependency module was not found.
Warning: At least one module has an unresolved import due to a missing export function in a delay-load dependent module.

But I did not yet find which module it is.

tbeu added a commit that referenced this issue Aug 4, 2015
See #2. Avoid linker problem with Dymola
@tbeu
Copy link
Contributor

tbeu commented Aug 4, 2015

@thorade Can you please git clone again (to a new directory) and check simulation with Dymola again. Should be fixed by 26754cb.

@thorade
Copy link
Contributor

thorade commented Aug 4, 2015

Yes, now it works out of the box!

@tbeu
Copy link
Contributor

tbeu commented Aug 4, 2015

Thanks.

@tbeu tbeu closed this as completed Aug 4, 2015
@thorade
Copy link
Contributor

thorade commented Aug 4, 2015

Thanks!
I might be using the JSON reader in the future.

@tbeu
Copy link
Contributor

tbeu commented Aug 4, 2015

Sure. Tell me if you see improvement.

tbeu added a commit that referenced this issue Sep 9, 2015
Where previously only
```xml
<root>
  <table>[0,0;0.5,0.25;1,1]</table>
</root>
```
worked for arrays, now also
```xml
<root>
  <table>
    <row>0,0</row>
    <row>0.5,0.25</row>
    <row>1,1</row>
  </table>
</root>
```
or even
```xml
<root>
  <table>
    <val>0<val>
    <val>0<val>
    <val>0.5<val>
    <val>0.25<val>
    <val>1<val>
    <val>1<val>
  </table>
</root>
```
work.

See #2
tbeu added a commit that referenced this issue Sep 9, 2015
@tbeu
Copy link
Contributor

tbeu commented Sep 10, 2015

Argh, commit links should go to #3.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

3 participants