Location of user defined dynamic library for deployment

It turned out that in MacOS, foo.app/Contents/MacOS folder is the location where user defined dylib file is placed on deployment of the application.

But the problem is where is the location for user defined dll to be placed on deployment, i.e. release of application.

Welcome @yuji_suda

My apologies because I’m not exactly sure what you’re asking, but maybe the information on this page of the documentation will help you?

Scott C
Thank you for the comment. Now I prepared test source zip file. I hope you can realize the issue.
My xojo is version 2020r2.1 which I have a license.
My windows machine is windows 10 (visual studio 2019, cl.exe compiler installed) and mac is high sierra (Xocde 10.1) and catalina, both intel mac.

Please unzip for_xojo_forum_test_use.zip

lib_test_doc.txt contains compile statement for dynamic library both for windwos and mac.
There contained also console main application to check feasibility of each dynamic library.
xojo.project is a modification of the example of getPID application in the example provided in the xojo package.

In mac, build application is working good. But when it is transferred to catalina, the application did not work. Then I tried to place libtest_lib.dylib in the application’s Content/MacOS directory, it did work well. So it turn out that xojo.app with use of dylib in mac must have the corresponding dylib file in its Content/MacOS directory.

On the contray in windows, xojo local run fails first of all. and application folder built which contains exe file and xojo required dlls is added with the corresponding dll file, in my case test_lib_win.dll, the exe file fails resulting in FUNCTION NOT FOUND error, i.e. the application can not load the corresponding dll file.

In mac environment , local run is ok, and in another mac where the application is copied, the execution succeeds when the corresponding dylib file is copied to application’s Content/MacOS directory.

I hope you see the situation. In windows OS, kernel32.dll can be accessed to get PID, so system DLL is accessible, but user defied dll can not be accessible. How can I cope with this problem?

With best regards
Yuji Suda

p.s.New user cannot upload attachment. So I could not upload above mentioned zip file. I can send e-mail to you with the zip file. Or can you change my status to allow upload zip file?

Scott C
I could upload zip file at the following URL
https://tracker.xojo.com/xojoinc/xojo/-/issues/77979
Please check it.
Yuji Suda

For macOS, keep in mind that a user is not going to be able to copy files into that directory (or anywhere else within the bundle for that matter) as soon as your apps bundle is signed and notarized for distribution.

That said, there is a function that you can access with a Declare for loading dylibs at runtime called dlopen. That will probably also require the use of entitlements and possibly runtime signing options.

My apologies @yuji_suda, but I have zero experience when it comes to making my own custom libraries and incorporating them in Xojo apps.

If I need extra functionality, I always use Plugins from 3rd party vendors such as MBS & Einhugur or pre-built Frameworks from developers like Greg O. As well, I only play at macOS desktop apps, never Windows.

I might suggest asking further questions in the SDK forums. You might have better luck there.

@Greg_O has given you a good clue where to research next, by searching previous posts on the use of dlopen.

For future reference, you can upload zipped project files to your forum posts by using this icon:

Good luck :nerd_face:

Hi Greg
Thank you for your comment.
As for my issue, Robin kindly tested my source and posted a result to feadback URL.
https://tracker.xojo.com/xojoinc/xojo/-/issues/77979
It help me well. I am now checking for building dll in visual studio IDE not in command line.
Thank a lot.
Yuji

Hi Scott
This is the test for uploading zip file. And it failed since I am a new user. Anyway to change my status?
Yuji

I’m not sure. You could email hello@xojo.com and ask what the wait period is for new users. Good luck.

Hi Scott and Greg
The same issue has been posted in the feedback and Robin there showed me a resolution to proper way for implementation of my own dll to xojo project. See the following URL, I posted retry success test in zip file.
Yuji
https://tracker.xojo.com/xojoinc/xojo/-/issues/77979

1 Like

Hi Scott and Greg
Thanks to Robin at the xojo feedback site, the answer for this topic is.

The location of user defined dynamic library is CopyFiles in the section of build setting as shown in the attached image.

As for compilation, both visual studio IDE and command line cl.exe statement work.

1 Like

Hi Scott and Greg
my summary zip file is 26MB and this size is not acceptable in the forum( the max is 10MB here), so please see the corresponding zip file in the feedback site.
Yuji

https://tracker.xojo.com/xojoinc/xojo/-/issues/77979

myDllTest_xojo_2020r21_yuji_suda.zip

I’m glad you got it figured out @yuji_suda

If you refer back to my original post to you, the link in that post is about the build Copy files step :slightly_smiling_face:

Just to be clear, they still don’t belong in the macOS folder. Any libraries that you include in your built app should be in the Frameworks directory. If you don’t, you may run into signing and notarization issues later.

foo.app/Contents/Frameworks

1 Like

Hi Greg
Do you mean that user defined dylib must be manually placed just under Frameworks along with XojoFramework.framework?
Yuji

Not manually. Use a CopyFilesStep and specify Frameworks as the destination.

Hi Greg
Thanks a lot. Now I got an idea that I need two copyFiles in build step for different destination folder. One is for App Parent Folder, the other is for Framwork Folder.
Best regards
Yuji