question

Sheldon C4 avatar image
0 Likes"
Sheldon C4 asked Jonah K answered

dll path error with mandarin chinese

Hi,

I am using customer code with a DLL. If the DLL path contains Mandarin Chinese characters, the DLL file cannot be found.

Example:

  1. // DLL path:
  2. "D:\測試路徑\AdventurerBoard\AdventurerBoard.dll"
  3. // << The file cannot be loaded.
  4. // DLL path:
  5. "D:\AdventurerBoard\AdventurerBoard.dll"
  6. // << The file can be successfully loaded.

How can I resolve this issue?


FlexSim 24.2.2
module sdkdll
· 9
5 |100000

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.

Jordan Johnson avatar image
0 Likes"
Jordan Johnson answered Phil BoBo edited

This looks like a bug to me. I suspect we are not handling non-ascii characters in the path correctly. I'll add this issue to the dev list.

· 5
5 |100000

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.

Phil BoBo avatar image Phil BoBo ♦♦ commented ·

@Sheldon C4 You may also want to use a relative path instead of an absolute path. You can use paths relative to the model or the FlexSim program directory.

I'd also suggest using the Module SDK instead of the DLL Maker.

0 Likes 0 ·
Sheldon C4 avatar image Sheldon C4 Phil BoBo ♦♦ commented ·

To Jordan

Is there any way for me to resolve this issue on my own before the bug is fixed in the new version?

I keep receiving calls from my colleagues asking why the model isn't working, and it’s becoming quite frustrating.


To Phil

Thank you for your suggestions. I will address them in the following two points:

  1. Regarding the use of a relative path
    I used an absolute path to clearly identify the problem. However, the issue persists regardless of whether an absolute or relative path is used.

  2. Module SDK or DLL Maker
    I am using the Module SDK downloaded from the 2024 FlexSim documentation. If there is a version-related issue, please let me know.

Additional Question: Could you clarify the differences between the Module SDK and the DLL Maker? Based on my understanding, the difference is solely related to the version, or are they entirely different products?


1 Like 1 ·
Phil BoBo avatar image Phil BoBo ♦♦ Sheldon C4 commented ·

Without a change to how FlexSim handles loading dlls by path, the way to "resolve this issue on [your] own" is to not use Unicode characters in the path to the dll.

That's one reason why I recommended using the module sdk: it will then find your dll by the name of the module within FlexSim's modules directory rather than an arbitrary path on the computer.

See Module Development

The primary difference between the DLL Maker and the Module SDK is that the Module SDK directly links to FlexSim libraries, which means it has to be updated with the latest version of those libraries for each version of FlexSim. The DLL Maker loads the "dllexport" functions from the application as "dllimport" functions in the dll using their signatures instead of linking directly to the FlexSim libs and using FlexSim headers for function definitions. Because the DLL Maker doesn't link directly, you don't have to recompile your dll for each version of FlexSim.

But the main difference related to this discussion is that module dlls are loaded using a different path mechanism than dll maker dlls, which is why you may be able to resolve your path issue by using a module dll. They're loaded directly from FlexSim's modules folder rather than adding additional paths to the Windows DLL search order, which doesn't seem to be working for Unicode paths based on this discussion.

0 Likes 0 ·
Show more comments
Jonah K avatar image
0 Likes"
Jonah K answered
This has been fixed in version 24.0.10 released today.
5 |100000

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.