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

Conversion errors in ipc.h #23

Closed
PeregrineZ opened this issue Dec 26, 2017 · 6 comments
Closed

Conversion errors in ipc.h #23

PeregrineZ opened this issue Dec 26, 2017 · 6 comments

Comments

@PeregrineZ
Copy link

I was using libnx to compile a test executable for the Switch (thanks for this, by the way!), when I ran into some errors related to invalid conversions in ipc.h while compiling. Here's the error:

aarch64-none-elf-g++ -o C:/Users/mason/source/repos/Switch/Switch/Build/Main.out -LC:/devkitPro/libnx/lib -IC:/devkitPro/libnx/include -lnx -static -static-libgcc -static-libstdc++ Main.cpp <

In file included from C:/devkitPro/libnx/include/switch.h:15:0,
                 from Main.cpp:3:
C:/devkitPro/libnx/include/switch/ipc.h: In function 'void* ipcPrepareHeader(IpcCommand*, size_t)':
C:/devkitPro/libnx/include/switch/ipc.h:109:25: error: invalid conversion from 'void*' to 'u32* {aka unsigned int*}' [-fpermissive]
     u32* buf = armGetTls();
                ~~~~~~~~~^~
C:/devkitPro/libnx/include/switch/ipc.h: In function 'Result ipcParseResponse(IpcCommandResponse*)':
C:/devkitPro/libnx/include/switch/ipc.h:209:25: error: invalid conversion from 'void*' to 'u32* {aka unsigned int*}' [-fpermissive]
     u32* buf = armGetTls();
                ~~~~~~~~~^~
C:/devkitPro/libnx/include/switch/ipc.h: In function 'Result ipcQueryPointerBufferSize(Handle, size_t*)':
C:/devkitPro/libnx/include/switch/ipc.h:262:25: error: invalid conversion from 'void*' to 'u32* {aka unsigned int*}' [-fpermissive]
     u32* buf = armGetTls();
                ~~~~~~~~~^~
C:/devkitPro/libnx/include/switch/ipc.h:283:20: error: invalid conversion from 'void*' to 'ipcQueryPointerBufferSize(Handle, size_t*)::<unnamed struct>*' [-fpermissive]
         } *raw = r.Raw;
                  ~~^~~
C:/devkitPro/libnx/include/switch/ipc.h: In function 'Result ipcConvertSessionToDomain(Handle, u32*)':
C:/devkitPro/libnx/include/switch/ipc.h:297:25: error: invalid conversion from 'void*' to 'u32* {aka unsigned int*}' [-fpermissive]
     u32* buf = armGetTls();
                ~~~~~~~~~^~
C:/devkitPro/libnx/include/switch/ipc.h:316:20: error: invalid conversion from 'void*' to 'ipcConvertSessionToDomain(Handle, u32*)::<unnamed struct>*' [-fpermissive]
         } *raw = r.Raw;
                  ~~^~~

I seemed to fix these errors by casting armGetTls() to (u32*) in each occurrance, and by naming the mentioned structs "raw" and casting r.Raw to (struct raw *). Here are the lines:

Lines 109, 209, 262, 297:

u32* buf = (u32*) armGetTls();

Lines 279-283, 312-316:

struct raw {
    u64 magic;
    u64 result;
    u32 object_id;
} *raw = (struct raw *) r.Raw;

Feel free to change these, I'm kind of a novice at C/C++, so there might be some unintended consequences haha.

Keep up the great work!

@yellows8
Copy link
Contributor

yellows8 commented Dec 27, 2017

Which devkitA64 release are you using?(And what libnx commit)

@PeregrineZ
Copy link
Author

I'm using devkitA64 Alpha 5 and the latest libnx commit (1fccd4a).

@yellows8
Copy link
Contributor

yellows8 commented Dec 28, 2017

Did you modify the Makefile for this app at all? EDIT: Are you even using the example Makefile?

@PeregrineZ
Copy link
Author

Nope. I downloaded the zip, ran make and make install, and ran a test build.

@yellows8
Copy link
Contributor

Are you running make with an example from switch-examples, or what?

@plutooo
Copy link
Member

plutooo commented Jan 12, 2018

Can't repro

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