onu0ro
asked on
Calling functions from another module
Hi there. I'm writing a sort of a strategy game in which every player writes his own client and they all compete in battles hosted by a server. My problem is that I want the clients to be written in c or pascal and the contestants will submit their source codes. So, I'll have to compile the .c and .pas files on my server. I heard that's possible to compile them into .obj files and then call some functions from the server. How do i use the linker to do that ? I'm using djcpp.
Thanks, Onu
Thanks, Onu
You need dynamic library. Rather than DJGPP, I suggest you to use Visual C++ or Borland C++ or Delphi that support DLL/ ActiveX.
ASKER
I also thought of this. But I can't tell the people to write dll's for clients. Nobody does that. I need to find a way to call the function from the .obj. I'm rather new to this, so I don't even know if it's possible or not. Anyway, it's the .obj way that it's got to be.
Thanx
Thanx
It is possible if you have them write it in C. Just as you can have your code in separate modules, compiled into objs and then linked together, so can other people - especially if they are going to give you source code.
However, a DLL makes things much easier for you, as it defines the exact method of interface between you and the other modules.
You will need to define function prototypes in a header file for people to include in their project. They should be told to NOT change the header file. Expect to do ALOT of debugging...
However, a DLL makes things much easier for you, as it defines the exact method of interface between you and the other modules.
You will need to define function prototypes in a header file for people to include in their project. They should be told to NOT change the header file. Expect to do ALOT of debugging...
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Of course, if they are sending you source code, and you've predefined the function prototypes, nothing is preventing you from compiling them into a DLL - they don't have to do anything special except use your function prototypes. A DLL and a static lib are not that different...