Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Supports compiling with VC4 #55

Open
roytam1 opened this issue Dec 27, 2022 · 21 comments
Open

Supports compiling with VC4 #55

roytam1 opened this issue Dec 27, 2022 · 21 comments

Comments

@roytam1
Copy link

roytam1 commented Dec 27, 2022

I wonder if this can be done. Motivation is that, if we can compile it with VC4, we can try to compile it with VC4 RISC Edition to create MIPS binary.

My trial is that:

  • create project files
  • try to get rid of VC4 errors about typename (by #defining typename as class, defining explicit as nothing) and bool/true/false by include yvals.h)

but it still complains CRITICAL_SECTION and other standard windows functions:

--------------------Configuration: GreenPad - Win32 Release--------------------
Compiling...
stdafx.cpp
kilib\thread.h(143) : error C2501: 'CRITICAL_SECTION' : missing decl-specifiers
kilib\thread.h(143) : error C2143: syntax error : missing ';' before '*'
kilib\thread.h(143) : error C2501: 'pCs_' : missing decl-specifiers
kilib\thread.h(148) : error C2501: 'CRITICAL_SECTION' : missing decl-specifiers
kilib\thread.h(148) : error C2146: syntax error : missing ';' before identifier 'csection_'
kilib\thread.h(148) : error C2501: 'csection_' : missing decl-specifiers
kilib\thread.h(190) : error C2501: 'CRITICAL_SECTION' : missing decl-specifiers
kilib\thread.h(190) : error C2143: syntax error : missing ';' before '*'
kilib\thread.h(190) : error C2501: 'pCs_' : missing decl-specifiers
kilib\thread.h(195) : error C2501: 'CRITICAL_SECTION' : missing decl-specifiers
kilib\thread.h(195) : error C2146: syntax error : missing ';' before identifier 'csection_'
kilib\thread.h(195) : error C2501: 'csection_' : missing decl-specifiers
kilib\string.h(57) : error C2535: 'class ki::String &String::operator =(const unsigned short *)' : member function already defined or declared
kilib\string.h(186) : error C2517: 'lstrlen' : right of '::' is undefined
kilib\string.h(186) : error C2065: 'lstrlen' : undeclared identifier
kilib\string.h(186) : error C2064: term does not evaluate to a function
kilib\string.h(210) : error C2517: 'lstrcmp' : right of '::' is undefined
kilib\string.h(210) : error C2065: 'lstrcmp' : undeclared identifier
kilib\string.h(210) : error C2064: term does not evaluate to a function
kilib\string.h(216) : error C2517: 'lstrcmpi' : right of '::' is undefined
kilib\string.h(216) : error C2065: 'lstrcmpi' : undeclared identifier
kilib\string.h(216) : error C2064: term does not evaluate to a function
kilib\string.h(223) : error C2064: term does not evaluate to a function
kilib\string.h(229) : error C2064: term does not evaluate to a function
kilib\string.h(240) : warning C4190: '+' has C-linkage specified, but returns UDT 'String' which is incompatible with C
kilib\string.h(243) : warning C4190: '+' has C-linkage specified, but returns UDT 'String' which is incompatible with C
kilib\string.h(243) : error C2733: second C linkage of overloaded function '+' not allowed
kilib\string.h(246) : warning C4190: '+' has C-linkage specified, but returns UDT 'String' which is incompatible with C
kilib\string.h(246) : error C2733: second C linkage of overloaded function '+' not allowed
C:\MSDEV\INCLUDE\objidl.h(9194) : error C2065: 'memset' : undeclared identifier
C:\MSDEV\INCLUDE\objidl.h(9194) : error C2064: term does not evaluate to a function
C:\MSDEV\INCLUDE\objbase.h(470) : error C2065: 'memcmp' : undeclared identifier
C:\MSDEV\INCLUDE\objbase.h(470) : error C2064: term does not evaluate to a function
C:\MSDEV\INCLUDE\objbase.h(494) : error C2064: term does not evaluate to a function
Error executing cl.exe.
stdafx.obj - 31 error(s), 3 warning(s)

what do you think?

VC4 project files: GreenPad-vc4prj.zip

@roytam1
Copy link
Author

roytam1 commented Dec 28, 2022

Updated sources: GreenPad-vc4test.zip
detailed changes in: https://github.com/roytam1/rtoss/commits/master/GreenPad-vc4

and it leaves 2 mystery errors:

C:\GreenPad\Search.cpp(471) : error C2653: 'MacroCommand' : is not a class or namespace name
C:\GreenPad\Search.cpp(471) : error C2561: 'MacroCommand' : function must return a value

@RamonUnch
Copy link
Owner

Good idea I will give this a try.

@roytam1
Copy link
Author

roytam1 commented Dec 29, 2022

I almost get it to work, but there is a trap:

in void WndImpl::SetUpThunk( HWND wnd ) in window.cpp, it uses assembler code to replace 1st parameter to this for running WndImpl::MainProc by replacing with SetWindowLongPtr( wnd, GWLP_WNDPROC, ...).

we may need to write MIPS version of this or write a C/C++ version of this instead.

@roytam1
Copy link
Author

roytam1 commented Dec 29, 2022

alright I think I am finished porting it to NT MIPS.
roytam1/rtoss@28b6844

@roytam1
Copy link
Author

roytam1 commented Dec 29, 2022

compiled VC4 MIPS binary(and also MIPS version of libchardet (cdetmips.dll))
GreenPad-mips.zip

I can compile with TARGET_VER=310 for now, since there is no IMM32 import library, and broken SHGetPathFromIDList definition (only with SHGetPathFromIDList and no A/W suffix)

30/12 build: GreenPad-mips.zip

  • removed MSVC exception handling code to debloat on both GP and chardet

@RamonUnch
Copy link
Owner

Very Nice.
Good idea to get rid of thunking all-together, this saves a 4KB VirtualAlloc for each window.
Which SDK version are you using? When I installed VC++4.0 I do not get the yvals.h header file.

@roytam1
Copy link
Author

roytam1 commented Dec 29, 2022

Good idea to get rid of thunking all-together, this saves a 4KB VirtualAlloc for each window.

but it could be slower since every call to TrunkMainProc has to call GetWindowLong(GWL_USERDATA) to get back object handle.

Which SDK version are you using? When I installed VC++4.0 I do not get the yvals.h header file.

I use included header files and libraries.
yvals.h comes from VC4.2, I bundle it.

@roytam1
Copy link
Author

roytam1 commented Apr 12, 2023

and today @tenox7 decided to build it on PowerPC NT:
image

@RamonUnch
Copy link
Owner

Very nice indeed! Does it have a repo with official release? so I can link it in the readme?

I tried to cross compile using OpenWatcom but it seems Alpha and target is only available for plain C. (I could not find wppaxp but I did find wccaxp).

@roytam1
Copy link
Author

roytam1 commented Apr 12, 2023

Very nice indeed! Does it have a repo with official release? so I can link it in the readme?

still preparing (just added IA64 defines but no emulator/real machine for testing yet), and he built it from my VC4 tree's GreenPad.mak adding /DNO_ASMTHUNK and done.

@roytam1
Copy link
Author

roytam1 commented Apr 12, 2023

and for IA64 it may need some more fixes, but for now at least it starts.
image

@tenox7
Copy link

tenox7 commented Apr 13, 2023

I'm going to try to compile for AXP as well.

@roytam1
Copy link
Author

roytam1 commented Apr 18, 2023

ARM32 and ARM64 build with VC2017 works on a bare metal machine:
IMG_2025

don't know if it will work on a surface RT or not in the moment.

(P.S.: and LOBYTE(app().getOSVer()) goes strange on ARM64, shown in screenshot)

@RamonUnch
Copy link
Owner

Nice to see that, so the circle is almost complete in term of CPU architectures.

(P.S.: and LOBYTE(app().getOSVer()) goes strange on ARM64, shown in screenshot)

Maybe we should create use getOSVerMinor(), and getOSVerMajor().
I am not sure what the problem is.

@roytam1
Copy link
Author

roytam1 commented Apr 19, 2023

I am not sure what the problem is.

don't know if this is a VC2017's fault or not, as LOBYTE(x) means (x & 0xff) which shows ineffective in ARM64.

@roytam1
Copy link
Author

roytam1 commented Apr 19, 2023

works in UMCIAuditMode enabled Windows RT 8.1:
image

@roytam1
Copy link
Author

roytam1 commented Apr 20, 2023

tested on QEMU ARM64, ARM64 minor version bug workarounded by saving return in variable instead. also added display platform version defines for ARM(64).
image

@roytam1
Copy link
Author

roytam1 commented Apr 20, 2023

I could not find wppaxp but I did find wccaxp

maybe you can use wclaxp for all source files.

P.S.: there is an archive contains wppaxp and you can try with it: https://ftp2.zx.net.nz/pub/misc/watcom/

and by the way there are some WIP issue for NT-MIPS support in OpenWatcom: open-watcom/open-watcom-v2#1031

OpenWatcom also some foundation for generating NT-PowerPC but of course it is far to be usable in the moment.

@RamonUnch
Copy link
Owner

maybe you can use wclaxp for all source files.

wclaxp just trties to call wppaxp and fails, but after further testing when I do a simple C program i cannot even build it with wclaxp because even if it can be compiled by wccaxp it cannot be linked because of missing AXP specific lib files.
So I guess those are useless files on the OW distribution. Maybe I will open an issue about it.

P.S.: there is an archive contains wppaxp and you can try with it: https://ftp2.zx.net.nz/pub/misc/watcom/

Thanks for the link, I gave it a try and it works at 99%, I just need to get ConfigManager.cpp to build without a crash from OpenWatcom.

@RamonUnch
Copy link
Owner

RamonUnch commented Apr 20, 2023

@roytam1
Copy link
Author

roytam1 commented Jul 13, 2024

hmm, my old GreenPad works on PPC, but it need a refresh.
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants