Opened 4 years ago

Closed 3 years ago

#6242 closed defect (fixed)

Modelica External C dependencies are not found on Windows

Reported by: Niklas Worschech Owned by: Adrian Pop
Priority: blocker Milestone: 1.19.0
Component: Code Generation Version: v1.17.0-dev
Keywords: Modelica External C Cc: Simon.Leutz@…, Sven.Baetzing@…, fixed-term.Jonas.Plewinski@…, adeas31@…

Description

For a Modelica External C model that is connected to a Windows C- dll, the simulation in OMEdit aborts with the error:

Process crashed
Process crashed
Simulation process failed. Exited with code -1073741515.

If you copy all dependencies (dll's and possibly other dependent objects like a database) into the corresponding working directory of OMEdit for the model, the simulation starts correctly.

Change History (13)

comment:1 by Francesco Casella, 4 years ago

Cc: adeas31@… added

@adrpo, @mahge930, incidentally "Exited code -1073741515" makes absolutely no sense, and is kind of irritating. It looks like it wants to convey some kind of information, which is only accessible to the members of some arcane cabal that understands negative error codes with 10 digits. Modelica is arcane enough, we don't really need that :)

It turns out -1073741515 = 309 - 230. Could it be that we are not using the right printf string because of some 32/64-bit int/long int crap?

Also, it would be nice if we had a list of runtime exit codes somewhere, do we? If we do, I'd suggest to put it in the user's guide and add a URL link to that in the error message. Otherwise we should rather not give that message at all.

What do you think?

comment:2 by Mahder Alemseged Gebremedhin, 4 years ago

It turns out -1073741515 = 309 - 230. Could it be that we are not using the right printf string because of some 32/64-bit int/long int crap?

The error codes are hex but printed as decimal :). This specific error is 0xC0000135 in hex. You can see the error codes here:
https://docs.microsoft.com/en-us/openspecs/windows_protocols/ms-erref/596a1078-e883-4972-9bbc-49e60bebca55

This one is STATUS_DLL_NOT_FOUND. We should have an accompanying error message with it.

As for the actual problem itself, I guess you had already discussed it with Adrian. If not I can take a look.

Last edited 4 years ago by Mahder Alemseged Gebremedhin (previous) (diff)

comment:3 by Adrian Pop, 4 years ago

Yes, that is the error code for missing DLLs.
We need to add the LIBS directories to the PATH variable when we run the executables so that DLLs in the library resources can be found.

in reply to:  2 comment:4 by Francesco Casella, 4 years ago

Replying to mahge930:

It turns out -1073741515 = 309 - 230. Could it be that we are not using the right printf string because of some 32/64-bit int/long int crap?

The error codes are hex but printed as decimal :). This specific error is 0xC0000135 in hex.

Aha. Could we print them as hex?

You can see the error codes here:
https://docs.microsoft.com/en-us/openspecs/windows_protocols/ms-erref/596a1078-e883-4972-9bbc-49e60bebca55

This one is STATUS_DLL_NOT_FOUND. We should have an accompanying error message with it.

I see, I had no idea these were Microsoft (actually NT) error codes, I thought they were OMC errors. So, you are indeed part of some arcane cabal. Now I am too :)

If possible, I'd recommend to print the error as hex and add some link or reference to that page.

comment:5 by Mahder Alemseged Gebremedhin, 4 years ago

Arcane cable :) Nop. All I knew was that it is a hex code. From then on it's google who did the job.

I don't think omc issues any special error codes ( apart from exit(1) ). I am also not sure where this exact printing is coming from. I will check and get back to you.

It would be nice if the ticket had a MWE. It will save some time. Otherwise we will figure it out eventually.

Last edited 4 years ago by Mahder Alemseged Gebremedhin (previous) (diff)

in reply to:  5 comment:6 by Francesco Casella, 4 years ago

Replying to mahge930:

Arcane cable :) Nop. All I knew was that it is a hex code. From then on it's google who did the job.

Secret societies are no longer what they use to be. You can become a member just by googling stuff :)

I don't think omc issues any special error codes ( apart from exit(1) ). I am also not sure where this exact printing is coming from. I will check and get back to you.

If it is the OS, then never mind, blame Bill Gates for that.

It would be nice if the ticket had a MWE. It will save some time. Otherwise we will figure it out eventually.

I guess reproducing this thing is a non-trivial task, and may be difficult to reproduce on a different machine, depending on what's installed on it.

comment:7 by Francesco Casella, 4 years ago

Milestone: 1.16.11.17.0

We couldn't fix this in the bugfix releases. I'm retargeting to 1.17.0

comment:8 by Francesco Casella, 4 years ago

Milestone: 1.17.01.18.0

Retargeted to 1.18.0 because of 1.17.0 timed release.

comment:9 by Francesco Casella, 4 years ago

Milestone: 1.18.01.17.1
Priority: highblocker

comment:10 by Adrian Pop, 4 years ago

Milestone: 1.17.11.17.0
Owner: changed from Mahder Alemseged Gebremedhin to Adrian Pop
Priority: blockerhigh
Status: newaccepted

comment:11 by Adrian Pop, 4 years ago

Priority: highblocker

comment:12 by Adrian Pop, 4 years ago

Milestone: 1.17.01.17.1

comment:13 by Adrian Pop, 3 years ago

Milestone: 1.17.11.19.0
Resolution: fixed
Status: acceptedclosed
Note: See TracTickets for help on using tickets.