msquic
                                
                                 msquic copied to clipboard
                                
                                    msquic copied to clipboard
                            
                            
                            
                        QuicAddrSetFamily & QuicAddrSetPort not found
Describe the bug
Looks like I can't call QuicAddrSetFamily() or QuicAddrSetPort() on MacOS. Didn't see those functions in the header files in the release either.
Affected OS
- [ ] All
- [ ] Windows Server 2022
- [ ] Windows 11, version 22H2
- [ ] Windows 11, version 21H2
- [ ] Windows Insider Preview (specify affected build below)
- [ ] Ubuntu
- [ ] Debian
- [X] Other (specify below)
Additional OS information
macOS Monterey
MsQuic version
release/2.0
Steps taken to reproduce bug
- Download release 2.0 for mac universal
- Download sample.con Mac
- Compile gcc ./lib/msquic/msquic.dylib ./src/main.c -o ./bin/main.o
Expected behavior
It should successfully compile.
Actual outcome
It fails with the following output:
gcc ./lib/msquic/msquic.dylib ./src/main.c -o ./bin/main.o
Undefined symbols for architecture x86_64:
  "_QuicAddrSetFamily", referenced from:
      _RunServer in main-02bc1a.o
  "_QuicAddrSetPort", referenced from:
      _RunServer in main-02bc1a.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [main.o] Error 1
Additional details
No response
The definition should be in msquic_posix.h. I'm not sure why you're getting a compile error.
It’s failing because of the way inline works in c is funky, and clang actually cares that is is correct.
https://github.com/microsoft/msquic/blob/main/src/platform/inline.c
See the comments on here. You can fix it by copying the 2 definitions for those functions from that file into the sample code
This worked! Thank you @ThadHouse -- it would be helpful if this gotchya were in the documentation somewhere. Or possibly even including the definitions in the release zip? Not sure, but thanks either way.
Feel free to suggest a PR!
Closing this issue from lack of progress.
Hi,
See the comments on here. You can fix it by copying the 2 definitions for those functions from that file into the sample code
You can do that, or you can also compile your program with no (or less) optimizations, this might not be what you want but you can: gcc -O1 sample.c -o sample -lmsquic