Skip to content

Commit 2bc2eeb

Browse files
author
Henning Kiel
committed
- fix infinite recursive loop (call Implementation instead)
- include winsock2.h on windows, so that the code compiles there as well git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@16951 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
1 parent ba2f506 commit 2bc2eeb

File tree

2 files changed

+10
-38
lines changed

2 files changed

+10
-38
lines changed

Compiler/runtime/Socket_omc.c

Lines changed: 1 addition & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -31,49 +31,14 @@
3131
#include <stdio.h>
3232
#include <meta_modelica.h>
3333

34-
#if defined(__MINGW32__) || defined(_MSC_VER)
35-
36-
extern int Socket_waitforconnect(int _inInteger)
37-
{
38-
fprintf(stderr, "Socket NYI\n");
39-
MMC_THROW();
40-
}
41-
42-
extern const char* Socket_handlerequest(int _inInteger)
43-
{
44-
fprintf(stderr, "Socket NYI\n");
45-
MMC_THROW();
46-
}
47-
48-
extern void Socket_cleanup()
49-
{
50-
fprintf(stderr, "Socket NYI\n");
51-
MMC_THROW();
52-
}
53-
54-
extern void Socket_close(int _inInteger)
55-
{
56-
fprintf(stderr, "Socket NYI\n");
57-
MMC_THROW();
58-
}
59-
60-
extern void Socket_sendreply(int _inInteger, const char* _inString)
61-
{
62-
fprintf(stderr, "Socket NYI\n");
63-
MMC_THROW();
64-
}
65-
66-
#else
67-
6834
#include "socketimpl.c"
6935
#include "meta_modelica.h"
7036
#include "ModelicaUtilities.h"
7137

7238
extern const char* Socket_handlerequest(int sock)
7339
{
74-
char *str = Socket_handlerequest(sock);
40+
char *str = SocketImpl_handlerequest(sock);
7541
char *res = strcpy(ModelicaAllocateString(strlen(str)),str);
7642
free(str);
7743
return res;
7844
}
79-
#endif

Compiler/runtime/socketimpl.c

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,16 @@
2929
*/
3030

3131
#include <sys/types.h>
32-
#include <sys/socket.h>
3332
#include <stdio.h>
33+
34+
#if defined(__MINGW32__) || defined(_MSC_VER)
35+
#include <winsock2.h>
36+
#include <ws2tcpip.h>
37+
#else
38+
#include <sys/socket.h>
3439
#include <netinet/in.h>
40+
#endif
41+
3542
#include <string.h>
3643
#include <stdlib.h>
3744
#include <unistd.h>
@@ -102,7 +109,7 @@ extern int Socket_waitforconnect(int port)
102109
return ns;
103110
}
104111

105-
extern const char* SocketImpl_handlerequest(int sock)
112+
extern char* SocketImpl_handlerequest(int sock)
106113
{
107114
int bufSize=4000;
108115
char *tmpBuf,*buf;

0 commit comments

Comments
 (0)