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

PR#2 causes example file to no longer building on Windows. #3

Closed
Michaelangel007 opened this issue Mar 6, 2025 · 6 comments
Closed

Comments

@Michaelangel007
Copy link
Contributor

I've merged PR#2.

I've updated the examples/example_simple.c with the new include #include "src/one.c" mentioned in PR #2 however this now does not build with MSVC.exe

cl.exe -I. examples\example_simple.c /Fe:bin\example_simple.exe

Generates this error:

BearHttpsClient\src\src_dependencies\../../dependencies/UniversalSocket.c(345): error C2036: 'void *': unknown size

The line in question:

    received = recv(fd, buf + max, n - max, 0);

Likewise using the old filename with the new #include "BearHttpsClientOne.c" generates the same error:

BearHttpsClient\examples\BearHttpsClientOne.c(29544): error C2036: 'void *': unknown size

This line is not compiling:

    received = recv(fd, buf + max, n - max, 0);

This was previously compiling before the merge PR#2. I'm not sure what changed in the function ssize_t private_Universal_recv_all(int fd, void *buf, size_t n).

@mateusmoutinho
Copy link
Contributor

thanks for the subscribe man, I will generate a new release, as son as possible ,that compiles on msvc

@mateusmoutinho
Copy link
Contributor

mateusmoutinho commented Mar 8, 2025

these function: private_Universal_recv_all(int fd, void *buf, size_t n) , its a tricky solution that @SamuelHenriqueDeMoraisVitrio did afor windows , bacause windows dont have the flag: MSG_WAITALL (responsable to ensure all bytes were recived) , so he created a loop , for it

ssize_t private_Universal_recv_all(int fd, void *buf, size_t n){
  int max = 0;
  int received;

  while (max < n) {
    received = recv(fd, buf + max, n - max, 0);
  
    if (received <= 0) { 
      return received;
    }

    max += received;
  }

  return max;
}

@mateusmoutinho
Copy link
Contributor

mateusmoutinho commented Mar 8, 2025

@Michaelangel007 can you downcrease your Universal Socket version, on your build to check if the error still occurs ? , probably your install_dependencies.sh its using 0.2.6 version

@mateusmoutinho
Copy link
Contributor

aparently to these:
https://stackoverflow.com/questions/37460579/error-c2036-void-unknown-size
msvc can't calculate sizes into void pointers

@mateusmoutinho
Copy link
Contributor

Ithink , its fixed here

@Michaelangel007
Copy link
Contributor Author

Thanks! Merged PR #4 and the example builds correctly again on MSVC.

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

2 participants