Freebasic enet bindings

External libraries (GTK, GSL, SDL, Allegro, OpenGL, etc) questions.
Oz
Posts: 585
Joined: Jul 02, 2005 14:21
Location: Waterloo, Ontario, Canada
Contact:

Freebasic enet bindings

Postby Oz » Oct 28, 2012 20:55

Enet Game Networking

enet.bespin.com description wrote:ENet's purpose is to provide a relatively thin, simple and robust network communication layer on top of UDP (User Datagram Protocol). The primary feature it provides is optional reliable, in-order delivery of packets.

ENet omits certain higher level networking features such as authentication, lobbying, server discovery, encryption, or other similar tasks that are particularly application specific so that the library remains flexible, portable, and easily embeddable.


Grab it from github: https://github.com/mrozbarry/enet

I should mention I did the translations with dkl's fbfrog tool.

Updates:
  • Updated enet.bi with include it's library, as well as winmm on the windows platform
  • Uploaded win32/mingw libenet.a
  • Fixed a bunch of errors I saw when I tried compiling against libenet.a
  • Note: In windows, if you are creating a console application (no gui), you must add `winmm` to the linker (-l winmm). For some reason, I can't statically link to it from Code::Blocks. The gfx library in fb automatically links to this, so it is not an issue for any app that sets the screen resolution/is a visual app.
  • Added a simple authoritative server example with a client (See bindings/freebasic/example/readme.txt for details)

Hope that helps some people :)
-Oz
Last edited by Oz on Nov 06, 2012 15:39, edited 1 time in total.
Kot
Posts: 324
Joined: Dec 28, 2006 10:34

Re: Freebasic enet bindings

Postby Kot » Nov 05, 2012 21:55

When I try to compile this base program:

Code: Select all

include "enet/enet.bi"

If enet_initialize<>0 Then
   Print "An error occurred while initializing ENet."
EndIf
Sleep

I get this error:

base.o:fake:(.text+0x3a): undefined reference to `enet_initialize'

What am I doing wrong?
Oz
Posts: 585
Joined: Jul 02, 2005 14:21
Location: Waterloo, Ontario, Canada
Contact:

Re: Freebasic enet bindings

Postby Oz » Nov 05, 2012 22:15

You're not linking to enet - try adding:

Code: Select all

#inclib "enet"


To the top of your code :)
TJF
Posts: 3324
Joined: Dec 06, 2009 22:27
Location: N47°, E15°

Re: Freebasic enet bindings

Postby TJF » Nov 06, 2012 7:38

Oz wrote: - try adding:

Code: Select all

#inclib "enet"

Is there any reason why you didn't place this statement inside the header file (like it's done in all the other FB headers)?
Oz
Posts: 585
Joined: Jul 02, 2005 14:21
Location: Waterloo, Ontario, Canada
Contact:

Re: Freebasic enet bindings

Postby Oz » Nov 06, 2012 14:38

TJF wrote:Is there any reason why you didn't place this statement inside the header file (like it's done in all the other FB headers)?


None, other than I'm more of a C programmer, and I think adding -l enet to your build commandline or #inclib "enet" to the top of your code isn't a terrible burden, however, if that's a preference, I can add it to the enet.bi header file.

-Oz
counting_pine
Site Admin
Posts: 5690
Joined: Jul 05, 2005 17:32
Location: Manchester, Lancs

Re: Freebasic enet bindings

Postby counting_pine » Nov 06, 2012 14:45

Oz wrote:I think adding -l enet to your build commandline or #inclib "enet" to the top of your code isn't a terrible burden

Not for projects, no, but it does sting anyone using the "Paste+QuickRun" style of running code..
Oz
Posts: 585
Joined: Jul 02, 2005 14:21
Location: Waterloo, Ontario, Canada
Contact:

Re: Freebasic enet bindings

Postby Oz » Nov 06, 2012 15:39

Updated repo and first post, thanks guys!

-Oz

Return to “Libraries”

Who is online

Users browsing this forum: No registered users and 1 guest