Re: Frontend and backend communication

2011-11-29 Thread Dainius (GreatEmerald)
Ah, I see, that makes sense. And it now compiles correctly, thanks.

Re: Frontend and backend communication

2011-11-29 Thread Jacob Carlborg
On 2011-11-29 12:53, Dainius (GreatEmerald) wrote: I seem to have another problem with the function pointer approach. I am trying to set up a function that would pass the function pointers from C to D, and DMD refuses to compile it: If I have the function pointer struct with D calling convention

Re: Frontend and backend communication

2011-11-29 Thread Dainius (GreatEmerald)
I seem to have another problem with the function pointer approach. I am trying to set up a function that would pass the function pointers from C to D, and DMD refuses to compile it: If I have the function pointer struct with D calling convention pointers, like this: struct S_FrontendFunctions

Re: Frontend and backend communication

2011-10-18 Thread Dainius (GreatEmerald)
I'm trying to implement the function pointer system right now, and it seems to work on the C side, but not D. I assume I'm missing some kind of syntax here. I have these global variables: struct S_FrontendFunctions { void function() RedrawScreen; void function(const

Re: Frontend and backend communication

2011-08-10 Thread Dainius (GreatEmerald)
Oh, so structs themselves are only definitions and not global variables, I see. Thanks.

Re: Frontend and backend communication

2011-08-10 Thread Pelle
On Wed, 10 Aug 2011 10:35:46 +0200, Dainius (GreatEmerald) wrote: I seem to have run into a problem with the function pointer method here. I have this code: arco.d: struct FrontendFunctions { void function(SoundTypes) Sound_Play; void function() RedrawScreenFull;

Re: Frontend and backend communication

2011-08-10 Thread Dainius (GreatEmerald)
I seem to have run into a problem with the function pointer method here. I have this code: arco.d: struct FrontendFunctions { void function(SoundTypes) Sound_Play; void function() RedrawScreenFull; void function(const char*, int) PrecacheCard; void function(Car

Re: Frontend and backend communication

2011-07-29 Thread Dainius (GreatEmerald)
Yes, this is a library, so a main() there would be rather pointless. However, it seems that on many occasions compilers will simply not acknowledge anything without one, so I guess at least a declaration is in order... I'll have to try that out once I get back on Windows. Meanwhile, on Linux, I am

Re: Frontend and backend communication

2011-07-29 Thread Jesse Phillips
Dainius (GreatEmerald) Wrote: > So, now my (static) library nearly links in Win32. There is only one > link error, and apparently it's generated by phobos: > > ..\lib\phobos.lib(dmain2) > Error 42: Symbol Undefined __end > > Any clues about what is happening? Admittedly, that phobos.lib

Re: Frontend and backend communication

2011-07-29 Thread Dainius (GreatEmerald)
So, now my (static) library nearly links in Win32. There is only one link error, and apparently it's generated by phobos: ..\lib\phobos.lib(dmain2) Error 42: Symbol Undefined __end Any clues about what is happening? Admittedly, that phobos.lib is from March 20, 2011, so it's rather old b

Re: Frontend and backend communication

2011-07-29 Thread Dainius (GreatEmerald)
I see. Well, I guess I'll have to stick to static ones until this gets sorted out.

Re: Frontend and backend communication

2011-07-28 Thread Jacob Carlborg
On 2011-07-28 21:55, Dainius (GreatEmerald) wrote: On Thu, Jul 28, 2011 at 10:37 PM, Kai Meyer wrote: On 07/27/2011 04:40 PM, Dainius (GreatEmerald) wrote: One reason for the confusing responses is that in your original post you said: "a frontend (a library)", "a backend (an executable)", "Shu

Re: Frontend and backend communication

2011-07-28 Thread Dainius (GreatEmerald)
On Thu, Jul 28, 2011 at 10:37 PM, Kai Meyer wrote: > On 07/27/2011 04:40 PM, Dainius (GreatEmerald) wrote: > > One reason for the confusing responses is that in your original post you > said: > "a frontend (a library)", "a backend (an > executable)", "Shuffle() is a backend function", and "PlaySou

Re: Frontend and backend communication

2011-07-28 Thread Kai Meyer
On 07/28/2011 01:18 AM, Dainius (GreatEmerald) wrote: Hmm, there are still a whole lot of functions that call Shuffle(), so it might not be ideal. However, this gives me an idea - if a pointer to a function can be a parameter, can it be a global variable? In that case, the frontend would indeed b

Re: Frontend and backend communication

2011-07-28 Thread Kai Meyer
On 07/27/2011 04:40 PM, Dainius (GreatEmerald) wrote: No no. It's the other way round. Shuffle() is in the library (backend). PlaySound() is in the executable (frontend). Since I don't want the library to be dependent on any sound libraries, I can't have PlaySound() in it. And there is no other w

Re: Frontend and backend communication

2011-07-28 Thread Steven Schveighoffer
On Wed, 27 Jul 2011 13:41:37 -0400, Dainius (GreatEmerald) wrote: I have one program design problem and I wonder if anyone here could give any suggestions about it. The situation is like this: I am splitting a game into a frontend (a library) and a backend (an executable). The backend is goin

Re: Frontend and backend communication

2011-07-28 Thread novice2
Pelle Wrote: > On Wed, 27 Jul 2011 19:41:37 +0200, Dainius (GreatEmerald) > You could use a struct of function pointers to define the interface, if This is known approach in app, using plugin. For example, then open source FAR (File Archive Manager) exe load pluging dll, it fill strcuct with e

Re: Frontend and backend communication

2011-07-28 Thread Pelle
On Wed, 27 Jul 2011 19:41:37 +0200, Dainius (GreatEmerald) wrote: I have one program design problem and I wonder if anyone here could give any suggestions about it. The situation is like this: I am splitting a game into a frontend (a library) and a backend (an executable). The backend is goin

Re: Frontend and backend communication

2011-07-28 Thread Dainius (GreatEmerald)
Hmm, there are still a whole lot of functions that call Shuffle(), so it might not be ideal. However, this gives me an idea - if a pointer to a function can be a parameter, can it be a global variable? In that case, the frontend would indeed be able to overwrite the function that the backend calls

Re: Frontend and backend communication

2011-07-27 Thread novice2
Dainius (GreatEmerald) Wrote: > No no. It's the other way round. Shuffle() is in the library > (backend). PlaySound() is in the executable (frontend). Since I don't > want the library to be dependent on any sound libraries, I can't have would you pass playSound() as parameter (callback) to shuffl

Re: Frontend and backend communication

2011-07-27 Thread Dainius (GreatEmerald)
No no. It's the other way round. Shuffle() is in the library (backend). PlaySound() is in the executable (frontend). Since I don't want the library to be dependent on any sound libraries, I can't have PlaySound() in it. And there is no other way that I can think of to execute PlaySound() just at th

Re: Frontend and backend communication

2011-07-27 Thread Nick Sabalausky
"Dainius (GreatEmerald)" wrote in message news:mailman.1933.1311797423.14074.digitalmars-d-le...@puremagic.com... > Hm, well, at least I don't know how it's possible for a binary to > overwrite/capture a library's function. Would you care to give an > example? I'm not sure what you mean "overwri

Re: Frontend and backend communication

2011-07-27 Thread Dainius (GreatEmerald)
Hm, well, at least I don't know how it's possible for a binary to overwrite/capture a library's function. Would you care to give an example?

Re: Frontend and backend communication

2011-07-27 Thread Nick Sabalausky
"Dainius (GreatEmerald)" wrote in message news:mailman.1931.1311788506.14074.digitalmars-d-le...@puremagic.com... > For example, now I have a function Shuffle() that calls > PlaySound(SHUFFLE). Shuffle() is a backend function, while PlaySound() > is a frontend one, so obviously it won't work that

Frontend and backend communication

2011-07-27 Thread Dainius (GreatEmerald)
I have one program design problem and I wonder if anyone here could give any suggestions about it. The situation is like this: I am splitting a game into a frontend (a library) and a backend (an executable). The backend is going to handle all the game mechanics, while the frontend is going to handl