Hi Everyone, I am finally on this forum. I registered back in 2018 and the registration bugged out and failed and the admins never got back to me so I generated a new account!
Anyways, Welcome to be here. I have quite a large project where I have a Main.c that then includes a MySocket.H
In this Socket.H it has all the handles to newly created sockets and functions. If Main.C does not include this Main.C has no socket code nor global handles to implement any socket functionality.
When I include MySocket.h I then call my init command that kicks off the API and fills the GlobalVars in MySocket.H with active socket handle information.
From my Main.C I then call functions in MySocket.H to send data through the socket.
I then from my Main.C include another header for Debug information, we can call this MyDebug.H
It works wounder, However in MyDebug.H I use PrintF which forwards information through a different method to pipe out to my console, Not the same as a NET socket.
Now if from MyDebug.h I call the API's like Main.C would it would say that the function does not exist.
What is the best way for MyDebug.h to call commands into Socket.h if and only if Socket.H is included in Main.C.
My thoughts were that at the top of MyDebug.h I would put
#IfDef SomeVar
#Define FunctionToCall SocketSend
#else
#Define FunctionToCall OS_PrintF
#endif
and in Socket.H I would put #Define SomeVar then go and rename all my printfs to FunctionToCall (Making them require the same argument parameters and type).. But how do I get MyDebug.H to properly route the calls, Do I need an Extern function? How can I validate the Extern function exist before calling it. Now every project I include sockets (Aka MySockets.h).
I hope this is a simple question. I appreciate the feedback!!
-Agent