Re: Need help with decoding and understanding bgt's network implementation

BGT can't even wrap structs from DLLs. Well, it can. But it's one hell of a process

BGTLover wrote:

The most important limitation of them all is the mediocre support for calling dlls. I'd say, if you can't get basic dll things right, then why bother releasing it?
for one, it can't create, pass or in anyway modify what C calls structs. For that thing alone, almost 97% of C interfaces out there would need to first be wrapped in other dlls that manage the structs for the stupid bgt to make sense of them.
for example, let's say you have this declaration in a file called something like capy.h
typedef struct{
float x;
float y;
float z;
double angle;
} rotate_vector_2d;
and you have something like this:
bool do_objects_collide(struct rotate_vector_2d *first, struct rotate_vector_2d *second);
...and so on...
This is a very simple C API, I get it and I get that structs are maybe not the most shini thing in this situation, but bare with me for this example.
Bgt doesn't support creating and managing C stile structs like, for example, autoit, or any other language with dll support does, so, you'd need to create yet another dll to wrap it up. Let's say, now you created a dll that, by whatever means you want, knows how to reference the header file with that other function and struct declaration. In the wrap_capi.c, you'd have something like this:
#include<capi.h>
#include<stdlib.h>
rotate_vector_2d* vector_new(float x, float y, float z, double angle)
{
rotate_vector_2d *vec;
vec->x=x;
vec->y=y;
vec->z=z;
vec ->angle=angle;
return vec;
}
//and because dlls don't know about program scope, we need to implement this as well, I think. Even if not, this is a good approach to follow if the struct is something heavy and memory consuming, like a file, image, socket, physics related things like solid bodies, etc.
bool vector_free(struct rotate_2d_vector *vec)
{
return free(vec);
}
and keep in mind you'd need to do something like this, perhaps minus the freeing function,every...fucking...time...you need to expose structs to bgt. Now, remember I said this trick only works for somewhat simple C API's with relatively flat and simple structs like I've shown you. But now, try to imagine you have something like this:
typedef struct{
float radius;
point center; //assume we defined the point struct earlyer in this file or in some other included file
}circle;
typedef struct{
engine_type type;
int hp;
circle wheels[4];
} car;
imagine trying to wrap that monstrosity, can you do it like I did the previous example? now, really think about that, OK?

Enough said. And no, the irony of the name is not lost on me.

-- 
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector
  • ... AudioGames . net Forum — Developers room : mohamed via Audiogames-reflector
  • ... AudioGames . net Forum — Developers room : mohamed via Audiogames-reflector
  • ... AudioGames . net Forum — Developers room : mohamed via Audiogames-reflector
  • ... AudioGames . net Forum — Developers room : Turret via Audiogames-reflector
  • ... AudioGames . net Forum — Developers room : camlorn via Audiogames-reflector
  • ... AudioGames . net Forum — Developers room : tyrylu via Audiogames-reflector
  • ... AudioGames . net Forum — Developers room : cyrmax_it via Audiogames-reflector
  • ... AudioGames . net Forum — Developers room : cyrmax_it via Audiogames-reflector
  • ... AudioGames . net Forum — Developers room : cyrmax_it via Audiogames-reflector
  • ... AudioGames . net Forum — Developers room : camlorn via Audiogames-reflector
  • ... AudioGames . net Forum — Developers room : Turret via Audiogames-reflector
  • ... AudioGames . net Forum — Developers room : mohamed via Audiogames-reflector
  • ... AudioGames . net Forum — Developers room : camlorn via Audiogames-reflector
  • ... AudioGames . net Forum — Developers room : Nuno via Audiogames-reflector
  • ... AudioGames . net Forum — Developers room : mohamed via Audiogames-reflector
  • ... AudioGames . net Forum — Developers room : cyrmax_it via Audiogames-reflector
  • ... AudioGames . net Forum — Developers room : camlorn via Audiogames-reflector
  • ... AudioGames . net Forum — Developers room : bgt lover via Audiogames-reflector
  • ... AudioGames . net Forum — Developers room : Turret via Audiogames-reflector
  • ... AudioGames . net Forum — Developers room : bgt lover via Audiogames-reflector
  • ... AudioGames . net Forum — Developers room : bgt lover via Audiogames-reflector

Reply via email to