| Summary: | os/2 bits | ||
|---|---|---|---|
| Product: | SDL | Reporter: | Ozkan Sezer <sezeroz> |
| Component: | *don't know* | Assignee: | Sam Lantinga <slouken> |
| Status: | RESOLVED FIXED | QA Contact: | Sam Lantinga <slouken> |
| Severity: | normal | ||
| Priority: | P2 | CC: | icculus |
| Version: | HG 2.0 | ||
| Hardware: | x86 | ||
| OS: | OS/2 | ||
| Attachments: |
cpuinfo patch
dynapi patch thread.h patch |
||
|
Description
Ozkan Sezer
2017-08-21 19:55:19 UTC
Created attachment 2870 [details]
cpuinfo patch
Created attachment 2871 [details]
dynapi patch
Created attachment 2872 [details]
thread.h patch
Added, thanks! https://hg.libsdl.org/SDL/rev/fed4345ff3f2 https://hg.libsdl.org/SDL/rev/a6da0a386f68 https://hg.libsdl.org/SDL/rev/97cd834a843e (In reply to Ozkan Sezer from comment #0) > 2. SDL_dynapi.h: disable dynapi for os/2. This isn't super-urgent, but is there any reason this _can't_ work on OS/2, other than we still need to fill in some DosLoadModule/DosQueryProcAddr calls? --ryan. > This isn't super-urgent, but is there any reason this
> _can't_ work on OS/2, other than we still need to fill
> in some DosLoadModule/DosQueryProcAddr calls?
No, there is not.
>> This isn't super-urgent, but is there any reason this
>> _can't_ work on OS/2, other than we still need to fill
>> in some DosLoadModule/DosQueryProcAddr calls?
>
> No, there is not.
Well I forgot that there is this: if I do the following in SDL_dynapi.c
and define SDL_DYNAMIC_API as 1, it builds yes, but nothing is exported
in the dll, so I gave up without a fight. (The original 2.0.4 port by
Andrey possibly had the same issue.)
#elif defined(__OS2__)
#define INCL_DOS
#define INCL_DOSERRORS
#include <dos.h>
static SDL_INLINE void *get_sdlapi_entry(const char *fname, const char *sym)
{
HMODULE hmodule;
PFN retval = NULL;
char error[256];
if (NO_ERROR == DosLoadModule(&error, sizeof(error), fname, &hmodule)) {
if (NO_ERROR == DosQueryProcAddr(handle, 0, sym, &retval)) {
DosFreeModule(hmodule);
}
}
return retval;
}
> Well I forgot that there is this: if I do the following in SDL_dynapi.c > and define SDL_DYNAMIC_API as 1, it builds yes, but nothing is exported > in the dll, so I gave up without a fight. I've put this code in revision control: https://hg.libsdl.org/SDL/rev/6120f75935f9 Is BUILD_SDL defined when this code compiles? That's the magic in begin_code.h that tells OpenWatcom that DECLSPEC symbols should be exported, and should make SDL_DYNAPI_entry export in that file (at least, it _should_ do that...). Also, while we're talking: one of our Linux buildbots has OpenWatcom available on it, so if all this OS/2 work gets far enough along, we can have it start doing OS/2 builds on each commit. :) I already do this with PhysicsFS, fwiw: https://physfs-buildbot.icculus.org/builders/physfs-os2 --ryan. > I've put this code in revision control: https://hg.libsdl.org/SDL/rev/6120f75935f9 Well, it won't compile: I obviously pasted an old experiment (it's a mess on my hard drive), here's a one that really builds: diff -r 6120f75935f9 src/dynapi/SDL_dynapi.c --- a/src/dynapi/SDL_dynapi.c +++ b/src/dynapi/SDL_dynapi.c @@ -24,6 +24,12 @@ #if SDL_DYNAMIC_API +#if defined(__OS2__) +#define INCL_DOS +#define INCL_DOSERRORS +#include <dos.h> +#endif + #include "SDL.h" /* !!! FIXME: Shouldn't these be included in SDL.h? */ @@ -232,16 +238,13 @@ } #elif defined(__OS2__) -#define INCL_DOS -#define INCL_DOSERRORS -#include <dos.h> static SDL_INLINE void *get_sdlapi_entry(const char *fname, const char *sym) { HMODULE hmodule; PFN retval = NULL; char error[256]; if (NO_ERROR == DosLoadModule(&error, sizeof(error), fname, &hmodule)) { - if (NO_ERROR == DosQueryProcAddr(handle, 0, sym, &retval)) { + if (NO_ERROR == DosQueryProcAddr(hmodule, 0, sym, &retval)) { DosFreeModule(hmodule); } } > Is BUILD_SDL defined when this code compiles? That's the magic in begin_code.h > that tells OpenWatcom that DECLSPEC symbols should be exported, and should > make SDL_DYNAPI_entry export in that file (at least, it _should_ do that...). It is indeed defined by the makefile. However, my first comment was not completely correct, because : 1. SOME of the exports are missing, such as SDL_Log, e.g. testsuite fails like this: Error! E2028: SDL_Log is an undefined reference file testsprite2.obj(test/testsprite2.c): undefined symbol SDL_Log file SDL_test_common.obj(src/test/SDL_test_common.c): undefined symbol SDL_Log 2. dynapi.c, is missing SDLCALL everywhere in its table defines, so it requires work if one really wants to build with dynapi enabled. > Also, while we're talking: one of our Linux buildbots has OpenWatcom > available on it, so if all this OS/2 work gets far enough along, we > can have it start doing OS/2 builds on each commit. :) It would be cool. However, there are some fixes that needs to go in before a build can succeed: Bug #3740: otherwise testime.c won't build Bug #3767: because watcom doesn't ship with scalbn(), except for the v2 fork at github Optionals: bug #3769 and bug #3739 Besides, I don't know how you can build without the os/2 implementation files themselves. Andrey still haven't responded to me. (I can send to your private email, though, if you want.) > I already do this with PhysicsFS, fwiw: > https://physfs-buildbot.icculus.org/builders/physfs-os2 OK. OK, after several hours of pulling out my hair, found the culprit: wlib is not case-sensitive by default, and it discarded SDL_Log() in favor of SDL_log(). Using its -c switch when creating the import lib fixes everything. Created bug #3771. (In reply to Ozkan Sezer from comment #9) > Well, it won't compile: I obviously pasted an old experiment > (it's a mess on my hard drive), here's a one that really builds: This patch is now https://hg.libsdl.org/SDL/rev/6e1d0d1e2a5b, thanks! > Besides, I don't know how you can build without the os/2 implementation > files themselves. Andrey still haven't responded to me. (I can send to > your private email, though, if you want.) Yeah, I was just talking about the future. :) --ryan. |