[Dlang-internal] A Proof of Concept for the baremetal D runtime plans

mbalantz arbofo at hotmail.com
Fri May 3 23:49:23 UTC 2019


On 2019-05-03 4:31 p.m., Mike Franklin wrote:
> On Friday, 3 May 2019 at 23:20:13 UTC, mbalantz wrote:
> 
>> * The linker errors complain about undefined symbols and mention 
>> alphanumeric strings as reference, containing the SDL binding for D 
>> keywords and SDL keywords as per the functions that used them in the 
>> pongd.d file.
> 
> I'm sorry, but I don't fully understand.  Please copy and paste a few of 
> the errors here.
> 
>> * I downloaded and installed the dmd compiler on x86_64 Windows 10 
>> Education on an AMD Ryzen 1950X. Therefore:
> 
> I think DMD is fine if you want to do bare-metal programming on x86_64.
> 
>> * ..it is not truly baremetal. I intended to share it to show a demo, 
>> and then maybe we could look into reverse engineering it to be 
>> baremetal. Though I don't know if I picked a good demo for running 
>> baremetal (i.e. a pong game).
> 
> What I'm able to ascertain from this is that you've ported a pong game 
> to SDL, not to bare metal.  If SDL were ported to bare metal, then it 
> would probably work because SDL abstracts the architecture and platform 
> for you.
> 
>> * Yes, it is quite dependent on SDL. Porting SDL to D would be no 
>> small task, I would think? I tried using the bindbc bindings provided 
>> in D's library to provide the SDL. Though that is not sufficient? The 
>> linker errors complain of undefined symbols for a lot of SDL functions.
> 
> Yes, porting SDL to D would be a big task.  I don't think it's necessary 
> though because D has good support for binding to C APIs.  You can try 
> compiling with -betterC to see if that gets rid of some of the linker 
> errors you're encountering.  Otherwise, I'd need to see the linker 
> output to understand what's going on.
> 
> Mike
> 
> 

Thanks again for getting back to me. Sorry, forgot to include linker 
output. The errors are Error 42: symbol undefined and "linker exited 
status 21"

As follows:

PS C:\Users\mbala\workspace\D\pongd_actual\source> dmd pongd.d 
-odC:\Users\mbala\workspace\D\pongd\out\production\pongd\obj -ofpongd 
-IC:\Users\mbala\Download
s\SDL2-2.0.9\x86_64-w64-mingw32\include\SDL2 
-LC:\Users\mbala\Downloads\SDL2-2.0.9-win32-x64\SDL2.dll
pongd.d(399): Deprecation: switch case fallthrough - use 'goto case;' if 
intended
pongd.d(401): Deprecation: switch case fallthrough - use 'goto case;' if 
intended
pongd.d(403): Deprecation: switch case fallthrough - use 'goto default;' 
if intended
OPTLINK (R) for Win32  Release 8.00.17
Copyright (C) Digital Mars 1989-2013  All rights reserved.
http://www.digitalmars.com/ctg/optlink.html
OPTLINK : Warning 9: Unknown Option : NOIC
:\Users\mbala\Downloads\SDL2-2.0.9-win32-x64\SDL2.dll
  Warning 2: File Not Found 
:\Users\mbala\Downloads\SDL2-2.0.9-win32-x64\SDL2.dll
C:\Users\mbala\workspace\D\pongd\out\production\pongd\obj\pongd.obj(pongd)
  Error 42: Symbol Undefined __D6bindbc3sdl4bindQj8SDL_QuitPUNbNiZv
C:\Users\mbala\workspace\D\pongd\out\production\pongd\obj\pongd.obj(pongd)
  Error 42: Symbol Undefined 
__D6bindbc3sdl4bind8sdlvideo17SDL_DestroyWindowPUNbNiPSQCaQBwQBvQBt10SDL_WindowZv
C:\Users\mbala\workspace\D\pongd\out\production\pongd\obj\pongd.obj(pongd)
  Error 42: Symbol Undefined 
__D6bindbc3sdl4bind9sdlrender19SDL_DestroyRendererPUNbNiPSQCdQBzQByQBw12SDL_RendererZv
C:\Users\mbala\workspace\D\pongd\out\production\pongd\obj\pongd.obj(pongd)
  Error 42: Symbol Undefined 
__D6bindbc3sdl4bind10sdlsurface15SDL_FreeSurfacePUNbNiPSQCbQBxQBwQBu11SDL_SurfaceZv
C:\Users\mbala\workspace\D\pongd\out\production\pongd\obj\pongd.obj(pongd)
  Error 42: Symbol Undefined 
__D6bindbc3sdl4bind9sdlrender17SDL_RenderPresentPUNbNiPSQCbQBxQBwQBu12SDL_RendererZv
C:\Users\mbala\workspace\D\pongd\out\production\pongd\obj\pongd.obj(pongd)
  Error 42: Symbol Undefined 
__D6bindbc3sdl4Çäï9Çâëre¨er14SDL_RÇàîCopyPUNbNiPSQByÐuÐtÐr12Çèñ╔Çâ£DaQCwÐvÐt11Çä£TexturePxSQEcQDyÐx7ÇàÒct8Çå╝ctxPQBdZi
C:\Users\mbala\workspace\D\pongd\out\production\pongd\obj\pongd.obj(pongd)
  Error 42: Symbol Undefined 
__D6bindbc3sdl4bind9sdlrender17SDL_UpdateTexturePUNbNiPSQCbQBxQBwQBu11SDL_TexturePxSQDdQCzQCy7sdlrect8SDL_RectPxviZi
C:\Users\mbala\workspace\D\pongd\out\production\pongd\obj\pongd.obj(pongd)
  Error 42: Symbol Undefined __D6bindbc3sdl4bindQj8SDL_InitPUNbNikZi
C:\Users\mbala\workspace\D\pongd\out\production\pongd\obj\pongd.obj(pongd)
  Error 42: Symbol Undefined 
__D6bindbc3sdl4bind10sdlsurface12SDL_FillRectPUNbNiPSQByQBuQBtQBr11SDL_SurfacePxSQDaQCwQCv7sdlrect8SDL_RectkZi
C:\Users\mbala\workspace\D\pongd\out\production\pongd\obj\pongd.obj(pongd)
  Error 42: Symbol Undefined 
__D6bindbc3sdl4bind10sdlsurface15SDL_SetColorKeyPUNbNiPSQCbQBxQBwQBu11SDL_SurfaceikZi
C:\Users\mbala\workspace\D\pongd\out\production\pongd\obj\pongd.obj(pongd)
  Error 42: Symbol Undefined 
__D6bindbc3sdl4bind9sdlpixels10SDL_MapRGBPUNbNiPxSQBvQBrQBqQBo15SDL_PixelFormathhhZk
C:\Users\mbala\workspace\D\pongd\out\production\pongd\obj\pongd.obj(pongd)
  Error 42: Symbol Undefined 
__D6bindbc3sdl4bind8sdlerror12SDL_GetErrorPUNbNiZPxa
C:\Users\mbala\workspace\D\pongd\out\production\pongd\obj\pongd.obj(pongd)
  Error 42: Symbol Undefined 
__D6bindbc3sdl4bind10sdlsurface11SDL_LoadBMPFNbNiPxaZPSQCaQBwQBvQBt11SDL_Surface
C:\Users\mbala\workspace\D\pongd\out\production\pongd\obj\pongd.obj(pongd)
  Error 42: Symbol Undefined 
__D6bindbc3sdl4Çäï9Çâëre¨er28SDL_CreateTextureFromS¨facePUNbNiPSQCmÐiÐhÐf12Çä▓RÇà¥╔Çâ£DoÐkÐj10ÇâÍsÇå╣11ÇäÑÇçãZÇâÑEzÐvÐuÐsÇå£ÇçÝ
C:\Users\mbala\workspace\D\pongd\out\production\pongd\obj\pongd.obj(pongd)
  Error 42: Symbol Undefined 
__D6bindbc3sdl4Çäï9Çâëre¨er27SDL_CreateWÇâÜowAßRÇàø╔PUNbNiiikPPSQCpÐlÐk8Çâ╝video10Çä╗ÇåÁÇäíDwÐsÐrÐp12ÇäøÇêÃZi
C:\Users\mbala\workspace\D\pongd\out\production\pongd\obj\pongd.obj(pongd)
  Error 42: Symbol Undefined __D6bindbc3sdl4bind8sdltimer9SDL_DelayPUNbNikZv
C:\Users\mbala\workspace\D\pongd\out\production\pongd\obj\pongd.obj(pongd)
  Error 42: Symbol Undefined 
__D6bindbc3sdl4bind9sdlrender15SDL_RenderClearPUNbNiPSQBzQBvQBuQBs12SDL_RendererZi
C:\Users\mbala\workspace\D\pongd\out\production\pongd\obj\pongd.obj(pongd)
  Error 42: Symbol Undefined 
__D6bindbc3sdl4bind11sdlkeyboard20SDL_GetKeyboardStatePUNbNiPiZPh
C:\Users\mbala\workspace\D\pongd\out\production\pongd\obj\pongd.obj(pongd)
  Error 42: Symbol Undefined 
__D6bindbc3sdl4bind9sdlevents14SDL_PumpEventsPUNbNiZv
C:\Users\mbala\workspace\D\pongd\out\production\pongd\obj\pongd.obj(pongd)
  Error 42: Symbol Undefined 
__D6bindbc3sdl4bind8sdltimer12SDL_GetTicksPUNbNiZk
C:\Users\mbala\workspace\D\pongd\out\production\pongd\obj\pongd.obj(pongd)
  Error 42: Symbol Undefined 
__D6bindbc3sdl4bind8sdlvideo17SDL_GetWindowSizePUNbNiPSQCaQBwQBvQBt10SDL_WindowPiQcZv
Error: linker exited with status 21
PS C:\Users\mbala\workspace\D\pongd_actual\source>



More information about the Dlang-internal mailing list