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

Windows build is broken #72

Closed
db4 opened this issue Apr 9, 2019 · 4 comments · Fixed by #76
Closed

Windows build is broken #72

db4 opened this issue Apr 9, 2019 · 4 comments · Fixed by #76

Comments

@db4
Copy link

db4 commented Apr 9, 2019

Commit e79232c just destroyed it completely. Here are the fixes that make it compile again but I'm no expert in lwt I may do something incorrect.

diff --git a/src/lTerm_windows_stubs.c b/src/lTerm_windows_stubs.c
index b977dba..d818ec9 100644
--- a/src/lTerm_windows_stubs.c
+++ b/src/lTerm_windows_stubs.c
@@ -16,7 +16,6 @@
 
 #if defined(_WIN32) || defined(_WIN64)
 
-#include <windows.h>
 #include <lwt_unix.h>
 
 /* +-----------------------------------------------------------------+
@@ -140,24 +139,16 @@ static void worker_read_console_input(struct job_read_console_input *job)
   }
 }
 
-CAMLprim value lt_windows_read_console_input_job(value val_fd)
+static value result_read_console_input(struct job_read_console_input *job)
 {
-  LWT_UNIX_INIT_JOB(job, read_console_input, 0);
-  job->handle = Handle_val(val_fd);
-  job->error_code = 0;
-  CAMLreturn(lwt_unix_alloc_job(&(job->job)));
-}
-
-static value result_read_console_input_result(struct job_read_console_input *job)
-{
-  INPUT_RECORD input;
+  INPUT_RECORD * input;
   DWORD cks, bs;
   WORD code;
   int i;
   CAMLparam0();
   CAMLlocal3(result, x, y);
   int error_code = job->error_code;
-  input = job->input;
+  input = &(job->input);
   lwt_unix_free_job(&job->job);
   if (error_code) {
     win32_maperr(error_code);
@@ -212,6 +203,16 @@ static value result_read_console_input_result(struct job_read_console_input *job
   CAMLreturn(Val_int(0));
 }
 
+CAMLprim value lt_windows_read_console_input_job(value val_fd)
+{
+  CAMLparam0();
+  LWT_UNIX_INIT_JOB(job, read_console_input, 0);
+  job->handle = Handle_val(val_fd);
+  job->error_code = 0;
+  return lwt_unix_alloc_job(&(job->job));
+  CAMLreturn(lwt_unix_alloc_job(&(job->job)));
+}
+
 /* +-----------------------------------------------------------------+
    | Console informations                                            |
    +-----------------------------------------------------------------+ */
@pmetzger
Copy link
Member

Hi there! Sorry for not replying earlier. I recommend that you do a pull request, rather than submitting patches inside a problem report. We can then consider merging it.

@pmetzger
Copy link
Member

pmetzger commented May 14, 2019

Oh, also, if you could explain (for the benefit of those of us who don't know the Windows platform well) what broke exactly and how this fixes it, it will make it easier to evaluate the pull request.

kandu added a commit to kandu/lambda-term that referenced this issue Jun 15, 2019
kandu added a commit to kandu/lambda-term that referenced this issue Jun 15, 2019
kandu added a commit to kandu/lambda-term that referenced this issue Jun 15, 2019
@kandu
Copy link
Collaborator

kandu commented Jun 16, 2019

Thanks, @db4. I've read lwt_unix.h and other related source code(win32unix/unixsupport.c etc..) and didn't find any problem from your patch except one typo.

+  return lwt_unix_alloc_job(&(job->job));
+  CAMLreturn(lwt_unix_alloc_job(&(job->job)));

here we can just keep the second return statement.

@kandu kandu closed this as completed in #76 Jun 17, 2019
kandu added a commit that referenced this issue Jun 17, 2019
@db4
Copy link
Author

db4 commented Jun 17, 2019

+  return lwt_unix_alloc_job(&(job->job));
+  CAMLreturn(lwt_unix_alloc_job(&(job->job)));

here we can just keep the second return statement.

Indeed. Sorry for that.

@kandu kandu mentioned this issue Jun 17, 2019
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

Successfully merging a pull request may close this issue.

3 participants