www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - Can i using D & LLVM & SDL2 for Android?

reply dummy <dummy dummy.org> writes:
Just thought. I do want to know. :-)

As far as I know is,
   * LDC2 woring on NDK(yah!)
   * Native OpenGLES: 
http://wiki.dlang.org/Build_LDC_for_Android#Build_a_sample_OpenGL_Android_app_ported_to_D
   * Dlangui working on Android that based on SDL2: 
https://github.com/buggins/dlangui / 
https://dlang.org/blog/2016/10/07/project-highlight-dlangui/

regards,
Mar 07
parent reply Joakim <dlang joakim.fea.st> writes:
On Tuesday, 7 March 2017 at 12:06:48 UTC, dummy wrote:
 Just thought. I do want to know. :-)

 As far as I know is,
   * LDC2 woring on NDK(yah!)
   * Native OpenGLES: 
 http://wiki.dlang.org/Build_LDC_for_Android#Build_a_sample_OpenGL_Android_app_ported_to_D
   * Dlangui working on Android that based on SDL2: 
 https://github.com/buggins/dlangui / 
 https://dlang.org/blog/2016/10/07/project-highlight-dlangui/

 regards,
Yes, though I have not tried SDL2 myself.
Mar 08
parent reply dummy <dummy dummy.org> writes:
On Wednesday, 8 March 2017 at 10:24:24 UTC, Joakim wrote:
 On Tuesday, 7 March 2017 at 12:06:48 UTC, dummy wrote:
 Just thought. I do want to know. :-)

 As far as I know is,
   * LDC2 woring on NDK(yah!)
   * Native OpenGLES: 
 http://wiki.dlang.org/Build_LDC_for_Android#Build_a_sample_OpenGL_Android_app_ported_to_D
   * Dlangui working on Android that based on SDL2: 
 https://github.com/buggins/dlangui / 
 https://dlang.org/blog/2016/10/07/project-highlight-dlangui/

 regards,
Yes, though I have not tried SDL2 myself.
https://forum.dlang.org/post/hbumubsbrzffvgriaodw forum.dlang.org Ah, you're right. I will trying DerelictSDL2. Thx :-)
Mar 09
parent reply Joakim <dlang joakim.fea.st> writes:
On Thursday, 9 March 2017 at 10:35:18 UTC, dummy wrote:
 On Wednesday, 8 March 2017 at 10:24:24 UTC, Joakim wrote:
 On Tuesday, 7 March 2017 at 12:06:48 UTC, dummy wrote:
 Just thought. I do want to know. :-)

 As far as I know is,
   * LDC2 woring on NDK(yah!)
   * Native OpenGLES: 
 http://wiki.dlang.org/Build_LDC_for_Android#Build_a_sample_OpenGL_Android_app_ported_to_D
   * Dlangui working on Android that based on SDL2: 
 https://github.com/buggins/dlangui / 
 https://dlang.org/blog/2016/10/07/project-highlight-dlangui/

 regards,
Yes, though I have not tried SDL2 myself.
https://forum.dlang.org/post/hbumubsbrzffvgriaodw forum.dlang.org Ah, you're right. I will trying DerelictSDL2. Thx :-)
Regarding the link to that forum post, that bug has since been found and fixed. If you're planning on using Derelict, there is an issue where all Derelict libraries are loaded as shared libraries, whereas the Android port currently doesn't support loading shared libraries. If DLangUI is using SDL2, maybe he has a header file that allows him to statically link against SDL2, which you could reuse. Otherwise, you may need to generate one using DStep: https://github.com/jacob-carlborg/dstep or modify the DerelictSDL2 files to allow you to link statically.
Mar 12
next sibling parent reply rikki cattermole <rikki cattermole.co.nz> writes:
On 13/03/2017 7:48 PM, Joakim wrote:
 On Thursday, 9 March 2017 at 10:35:18 UTC, dummy wrote:
 On Wednesday, 8 March 2017 at 10:24:24 UTC, Joakim wrote:
 On Tuesday, 7 March 2017 at 12:06:48 UTC, dummy wrote:
 Just thought. I do want to know. :-)

 As far as I know is,
   * LDC2 woring on NDK(yah!)
   * Native OpenGLES:
 http://wiki.dlang.org/Build_LDC_for_Android#Build_a_sample_OpenGL_Android_app_ported_to_D

   * Dlangui working on Android that based on SDL2:
 https://github.com/buggins/dlangui /
 https://dlang.org/blog/2016/10/07/project-highlight-dlangui/

 regards,
Yes, though I have not tried SDL2 myself.
https://forum.dlang.org/post/hbumubsbrzffvgriaodw forum.dlang.org Ah, you're right. I will trying DerelictSDL2. Thx :-)
Regarding the link to that forum post, that bug has since been found and fixed. If you're planning on using Derelict, there is an issue where all Derelict libraries are loaded as shared libraries, whereas the Android port currently doesn't support loading shared libraries. If DLangUI is using SDL2, maybe he has a header file that allows him to statically link against SDL2, which you could reuse. Otherwise, you may need to generate one using DStep: https://github.com/jacob-carlborg/dstep or modify the DerelictSDL2 files to allow you to link statically.
Why exactly doesn't the Android port support dlopen, dlsym and dlclose? It is provided by the NDK libc. At least according to this[0]. [0] https://developer.android.com/ndk/guides/stable_apis.html
Mar 13
parent reply Joakim <dlang joakim.fea.st> writes:
On Monday, 13 March 2017 at 09:33:39 UTC, rikki cattermole wrote:
 On 13/03/2017 7:48 PM, Joakim wrote:
 [...]
Why exactly doesn't the Android port support dlopen, dlsym and dlclose? It is provided by the NDK libc. At least according to this[0]. [0] https://developer.android.com/ndk/guides/stable_apis.html
I was more talking about D shared libraries, which I'm assuming DerelictSDL2 qualifies as and would require Phobos built as a shared library. That hasn't been tried yet on Android. On Monday, 13 March 2017 at 10:11:35 UTC, Mike Parker wrote:
 On Monday, 13 March 2017 at 06:48:01 UTC, Joakim wrote:

 [...]
The alpha release of DerelictSDL2 3.0 supports static linking. When compiling manually, it requires -version=DerelictSDL_static on the command line and all files matching "derelict/sdl2/internal/*_dyn*.d" should be excluded from the build. When building DerelictSDL2 with DUB, specifying -cderelict-sdl2-static gets the job done, or the same can be added as a subConfiguration value in a project's dub.json/sdl file.
Thanks for the update, didn't know that.
Mar 13
parent reply rikki cattermole <rikki cattermole.co.nz> writes:
On 14/03/2017 6:08 AM, Joakim wrote:
 On Monday, 13 March 2017 at 09:33:39 UTC, rikki cattermole wrote:
 On 13/03/2017 7:48 PM, Joakim wrote:
 [...]
Why exactly doesn't the Android port support dlopen, dlsym and dlclose? It is provided by the NDK libc. At least according to this[0]. [0] https://developer.android.com/ndk/guides/stable_apis.html
I was more talking about D shared libraries, which I'm assuming DerelictSDL2 qualifies as and would require Phobos built as a shared library. That hasn't been tried yet on Android.
DerelictSDL2 would be statically linked, it would dynamically bind via dlopen, dlsym and dlclose to SDL itself which would be compiled as a shared library. This is how Derelict based libraries work.
Mar 13
parent Joakim <dlang joakim.fea.st> writes:
On Tuesday, 14 March 2017 at 01:57:56 UTC, rikki cattermole wrote:
 On 14/03/2017 6:08 AM, Joakim wrote:
 On Monday, 13 March 2017 at 09:33:39 UTC, rikki cattermole 
 wrote:
 On 13/03/2017 7:48 PM, Joakim wrote:
 [...]
Why exactly doesn't the Android port support dlopen, dlsym and dlclose? It is provided by the NDK libc. At least according to this[0]. [0] https://developer.android.com/ndk/guides/stable_apis.html
I was more talking about D shared libraries, which I'm assuming DerelictSDL2 qualifies as and would require Phobos built as a shared library. That hasn't been tried yet on Android.
DerelictSDL2 would be statically linked, it would dynamically bind via dlopen, dlsym and dlclose to SDL itself which would be compiled as a shared library. This is how Derelict based libraries work.
Ah, I have either misunderstood or forgotten how Derelict works. If the D code is all statically linked and only non-D, C/C++ shared libraries are loaded in addition to the single D shared library, there should be no problem using all Derelict modules on Android.
Mar 14
prev sibling next sibling parent reply Mike Parker <aldacron gmail.com> writes:
On Monday, 13 March 2017 at 06:48:01 UTC, Joakim wrote:

 If you're planning on using Derelict, there is an issue where 
 all Derelict libraries are loaded as shared libraries, whereas 
 the Android port currently doesn't support loading shared 
 libraries.  If DLangUI is using SDL2, maybe he has a header 
 file that allows him to statically link against SDL2, which you 
 could reuse.

 Otherwise, you may need to generate one using DStep:

 https://github.com/jacob-carlborg/dstep

 or modify the DerelictSDL2 files to allow you to link 
 statically.
The alpha release of DerelictSDL2 3.0 supports static linking. When compiling manually, it requires -version=DerelictSDL_static on the command line and all files matching "derelict/sdl2/internal/*_dyn*.d" should be excluded from the build. When building DerelictSDL2 with DUB, specifying -cderelict-sdl2-static gets the job done, or the same can be added as a subConfiguration value in a project's dub.json/sdl file.
Mar 13
parent dummy <dummy dummy.org> writes:
On Monday, 13 March 2017 at 10:11:35 UTC, Mike Parker wrote:
 On Monday, 13 March 2017 at 06:48:01 UTC, Joakim wrote:

 [...]
The alpha release of DerelictSDL2 3.0 supports static linking. When compiling manually, it requires -version=DerelictSDL_static on the command line and all files matching "derelict/sdl2/internal/*_dyn*.d" should be excluded from the build. When building DerelictSDL2 with DUB, specifying -cderelict-sdl2-static gets the job done, or the same can be added as a subConfiguration value in a project's dub.json/sdl file.
thanks for advices!! :-)
Mar 13
prev sibling parent dummy <dummy dummy.org> writes:
On Monday, 13 March 2017 at 06:48:01 UTC, Joakim wrote:
 On Thursday, 9 March 2017 at 10:35:18 UTC, dummy wrote:
 [...]
Regarding the link to that forum post, that bug has since been found and fixed. If you're planning on using Derelict, there is an issue where all Derelict libraries are loaded as shared libraries, whereas the Android port currently doesn't support loading shared libraries. If DLangUI is using SDL2, maybe he has a header file that allows him to statically link against SDL2, which you could reuse. Otherwise, you may need to generate one using DStep: https://github.com/jacob-carlborg/dstep or modify the DerelictSDL2 files to allow you to link statically.
thx! i will try it. :-D
Mar 13