-
Notifications
You must be signed in to change notification settings - Fork 76
No header definitions for exposed functions in uv_unix_udp.c #49
Comments
@nkolban I exposed externally used function in |
In the source file source/unix/uv_unix_udp.c here is (for example) a function called uv__udp_send(). This function appears to be used in source/uv_udp.c. However since there appears to be no definition of uv__udp_send in an headers .... it appears to be missing. Also ... and this is a question ... aren't files in souce/unix/* platform specific and hence definitions shouldn't be found in generic code such as source/uv_udp.c? |
@nkolban Because external project using libtuv we want to use |
Many thanks for the quick responses. If I am understanding correctly, functions such as uv__udp_... are meant to be platform specific. Does that mean that there should be a header file which defines the expected signatures of functions that are expected to be implemented by a platform? If that is the case, I think we are missing a header file for uv__udp...* ... or if not a header file, then forward declarations for them before use in the C source files that use them. |
@nkolban Yes, you're right. |
I'm compiling
The reason appears to be that at line 75 of |
I believe the reason is that you didn't compile with |
Howdy ... it isn't a "linkage" error ... a linkage error would say that I have source file However if in source file For example: A.c
and in B.c I would need
Typically this is done by having a header file such as:
and then B.c would become:
|
Ah, I found this. let's assume that we have a.c, b.c and main.c like below as you said. // a.c
#include <stdio.h>
void a() {
printf("a.c\n");
} // b.c
int b() {
a();
} // main.c
int main() {
b();
} compile with chokobole@wonyongkimPC:~/Workspace/iotjs/nuttx-iotjs-master/iotjs$ gcc -o main a.c b.c main.c
chokobole@wonyongkimPC:~/Workspace/iotjs/nuttx-iotjs-master/iotjs$ ./main
a.c this is because chokobole@wonyongkimPC:~/Workspace/iotjs/nuttx-iotjs-master/iotjs$ gcc -o main a.c b.c main.c -Wall
b.c: In function ‘b’:
b.c:2:3: warning: implicit declaration of function ‘a’ [-Wimplicit-function-declaration]
a();
^
b.c:3:1: warning: control reaches end of non-void function [-Wreturn-type]
}
^
main.c: In function ‘main’:
main.c:2:3: warning: implicit declaration of function ‘b’ [-Wimplicit-function-declaration]
b();
^
main.c:3:1: warning: control reaches end of non-void function [-Wreturn-type]
}
^ However, compile with chokobole@wonyongkimPC:~/Workspace/iotjs/nuttx-iotjs-master/iotjs$ g++ -o main a.c b.c main.c
b.c: In function ‘int b()’:
b.c:2:5: error: ‘a’ was not declared in this scope
a();
^
main.c: In function ‘int main()’:
main.c:2:5: error: ‘b’ was not declared in this scope
b();
^ In conclusion, I think I admit I was wrong, and we need header file to declare functions in header file or use forward declaration. |
Howdy my friend ... no wrong or right ... we are all friends here and I'm incorrect more than I'm on to something. Can I now assume that this issue is valid? If so I'll hold off until there is a fix. |
Thanks for the good points! Yes, we will fix this issue. |
Yes, it is a bug. I belive we need an internal header that declares |
This source file contains exposed functions which appear to be used elsewhere ... uv_unix_udp.c
However there is no header definition for the exposed functions.
The text was updated successfully, but these errors were encountered: