Results 1 to 6 of 6

Thread: Compiling SDL for WINCE

  1. #1

    Compiling SDL for WINCE

    Hi all!,
    I'm trying to crosscompile a foo JEDI-SDL based application for WinCE ARM.
    I'm using las Lazarus snapshot, and the last WINCE add-in under Windows XP SP2.
    Whenever I try to compile for WINCE I get the following errors:

    Code:
    project1.lpr(16) Error: Undefined symbol: SDL__PUTENV$PCHAR$$LONGINT
    project1.lpr(16) Error: Undefined symbol: SDL_GETENV$PCHAR$$PCHAR
    project1.lpr(16) Fatal: There were 2 errors compiling module, stopping
    Taking a look at the sources, it seems like those functions are declared to be external in MSVCRT.dll. They might not exist for Wince, I don't know.

    This the sourcecode I'm trying to compile (I think the compiler it's properly set up, because non-sdl applications are working perfectly):
    Code:
    program project1;
    
    {$mode delphi}
    
    
    uses
     sdl;
    
    var scr: PSDL_Surface; // Our main screen
    
    begin
     SDL_Init(SDL_INIT_VIDEO); // Initialize the video SDL subsystem
     scr:=SDL_SetVideoMode(640, 480, 8, SDL_SWSURFACE); // Create a software window of 640x480x8 and assign to scr
     SDL_Quit; // close the subsystems and SDL
    end.
    Has anybody succeded in compiling JEDI-SDL for WINCE?

    Thanks in advance,

    MoRLoP

  2. #2

    Compiling SDL for WINCE

    Do you know what conditional define is required for WINCE?

    I'm not sure if the JEDI-SDL headers have implemented the correct stubs for Get and Put Env.
    <A HREF="http://www.myhpf.co.uk/banner.asp?friend=139328">
    <br /><IMG SRC="http://www.myhpf.co.uk/banners/60x468.gif" BORDER="0">
    <br /></A>

  3. #3

    Compiling SDL for WINCE

    Hi Technomage,
    I think I understood the problem, but I have still some problems..
    I implemented getenv and putenv and now it compiles and links perfectly.

    Code:
    &#123;$mode delphi&#125;
    
    unit getenv;
    
    interface
    
    uses
      Classes, SysUtils; 
    
    function SDL_putenv&#40;const variable&#58; PChar&#41;&#58; integer;
    function SDL_getenv&#40;const name&#58; PChar&#41;&#58; PChar;
    function _putenv&#40; const variable &#58; Pchar &#41;&#58; integer;
    function _getenv&#40; const name &#58; Pchar &#41;&#58; PChar;
    function getenv&#40; const name &#58; Pchar &#41;&#58; PChar;
    function putenv&#40;const variable&#58; PChar&#41;&#58; integer;
    
    implementation
    type
      REnv_var=record
                 name&#58;string;
                 value&#58;string;
               end;
    var
      SDL_env&#58; array of REnv_var;
    &#123; Put a variable of the form "name=value" into the environment. &#125;
    function SDL_putenv&#40;const variable&#58; PChar&#41;&#58; integer;
    var
       name, value&#58; string;
       i,added&#58; integer;
       env_var&#58; REnv_var;
    begin
        if variable=nil then begin
           result&#58;=-1;
           exit;
        end;
    
        name&#58;= String&#40;variable&#41;;
        i&#58;=Pos&#40;'=',name&#41;;
        if &#40;i=0&#41; then begin
           result&#58;=-1;
           exit;
        end;
    
        &#123; Take the values &#125;
        env_var.value&#58;=Trim&#40;Copy&#40;name, i+1, Length&#40;name&#41;-i&#41;&#41;;
        env_var.name&#58;=Trim&#40;Copy&#40;name, 1, i-1&#41;&#41;;
    
        &#123; Check the variable is not already in the environment.
          If it is, replace it. &#125;
        added&#58;=-1;
        For i&#58;=0 to Length&#40;SDL_env&#41;-1 do begin
          if &#40;SDL_env&#91;i&#93;.name=env_var.name&#41; then begin
            SDL_env&#91;i&#93;.value&#58;=env_var.value;
            added&#58;=0;
            Break;
          end;
        end;
    
        if &#40;added=-1&#41; then begin
          SetLength&#40;SDL_env, Length&#40;SDL_env&#41;+1&#41;;
          SDL_env&#91;Length&#40;SDL_env&#41;-1&#93;.value&#58;=env_var.value;
          SDL_env&#91;Length&#40;SDL_env&#41;-1&#93;.name&#58;=env_var.name;
          added&#58;=0;
        end;
    
        Result&#58;=added;
    end;
    
    function SDL_getenv&#40;const name&#58; PChar&#41;&#58; PChar;
    var
      vname, venv&#58; String;
      i&#58;integer;
    begin
      vname&#58;=String&#40;name&#41;;
    
      For i&#58;=0 to Length&#40;SDL_env&#41;-1 do begin
         if &#40;SDL_env&#91;i&#93;.name=vname&#41; then begin
           venv&#58;=SDL_env&#91;i&#93;.name+'='+SDL_env&#91;i&#93;.value;
           Result&#58;=PChar&#40;venv&#41;;
           break;
         end;
      end;
    end;
    
    function _putenv&#40; const variable &#58; Pchar &#41;&#58; integer;
    begin
      Result&#58;=SDL_putenv&#40;variable&#41;;
    end;
    
    function putenv&#40; const variable &#58; Pchar &#41;&#58; integer;
    begin
      Result&#58;=SDL_putenv&#40;variable&#41;;
    end;
    
    function _getenv&#40; const name &#58; Pchar &#41;&#58; PChar;
    begin
      Result&#58;=SDL_getenv&#40;name&#41;;
    end;
    
    function getenv&#40; const name &#58; Pchar &#41;&#58; PChar;
    begin
      Result&#58;=SDL_getenv&#40;name&#41;;
    end;
    
    end.
    However, I get the following message whenever I try to execute the SDL-based application:

    "The file 'project1' cannot be opened. Either it is not signed with a trusted certificate, or one of its components cannot be found. If the problem persists, try reinstalling or restoring this file."

    I think it is because I still need a DLL (SDL.dll for WINCE), therefore I'm going to compile the original SDL for WINCE using a C compiler and see if it works. I will post my progress.

    Best regards,

    MoRLoP

  4. #4

    Compiling SDL for WINCE

    Hi MoRLoP,
    This is great news that you are looking at getting WinCE support for JEDI-SDL.

    With regard to your problem...It's very strange that FPC complains about "Undefined symbol: SDL__PUTENV" because SDL_Putenv is a locally defined function and the the OS specific _putenv and _getenv functions are externally defined.

    Are you using the latest snapshot from http://jedi-sdl.pascalgamedevelopment.com ? because is sounds like you may be using a very old version of the JEDI-SDL headers.

    You may also want to have a look at this thread
    It discusses the "not signed with a trusted certificate" issue, but I'm not sure if it will help.
    <br /><br />There are a lot of people who are dead while they are still alive. I want to be alive until the day I die.<br />-= Paulo Coelho =-

  5. #5

    Compiling SDL for WINCE

    Hi Savage!,
    I already got it working.
    As I had supposed it required SDL.dll compiled for WINCE.
    The problem with putenv and getenv is that they are probably not available for WINCE, or they are implemented in a different DLL. as far as I found they are not available for WINCE according to MSDN.

    I will make a post with my changes to the sources of JEDI-SDL to got it working ASAP.

    The problem now is that the demos are not working, and still don't know why ...

    Best regards,

    MoRLoP

  6. #6

    Compiling SDL for WINCE

    Great news, I look forward to seeing your changes so I can incorporate them into JEDI-SDL.
    <br /><br />There are a lot of people who are dead while they are still alive. I want to be alive until the day I die.<br />-= Paulo Coelho =-

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •