Community Forums Today's Posts     Member List     Archive    
Results 1 to 6 of 6
  1. #1
    Join Date
    Feb 2010
    Location
    Germany
    Posts
    3

    [Solved] How to compile a plugin?

    Hey Guys,
    this may sound like a noob question, well, i guess it is.
    Yesterday i got an idea for a little teamspeak plugin, so I downloaded the plugin SDK and looked over the doc and the example plugin. I've got a little C and C++ knowledge, so I think it should be possible for me to write the stuff I wanted.

    But before starting programming I wanted to try to compile the test plugin. In the past I only compiled little executables for my studies, but no libraries or stuff like that.
    I tried it with g++ on a ubuntu machine, but i got an error, because there was no main-function i guess. After googling about an hour with no solving for my problem i decided to ask here.

    How do i compile a plugin for Linux?

    P.s.: Please excuse my bad english, i'm not a native speaker
    Last edited by blophy; 02-02-2010 at 15:47.

  2. #2
    Join Date
    Jun 2008
    Location
    Krün, Germany
    Posts
    464
    Quick compiling on Linux:

    * Rename the plugin name in plugin.c to something suitable, just to make sure it's your plugin which gets loaded.
    * From the plugin SDK src/ directory, where the demo plugin code is located:

    $ gcc -c -O2 -Wall -fPIC -DLINUX -I../include plugin.c
    $ gcc -o libmyts3_plugin.so -shared plugin.o

    * copy libmyts3_plugin.so to the plugins directory of your TS3 installation
    * run TS3 and enable your new plugin

    I suppose adding a Makefile to plugin SDK for Linux should be a good plan. Still it shouldn't be difficult to write one yourself with the above information.

  3. #3
    Join Date
    Feb 2010
    Location
    Germany
    Posts
    3
    Thank you very much.Works for me now.

    Yeah, a Makefile would be great, so people wouldn't have to ask. Well, but here's a nice little tutorial now, so that shouldn't be a problem, if you use the search function of the forum.

  4. #4
    Join Date
    May 2007
    Location
    Eastern NC
    Posts
    1,378
    Quote Originally Posted by PeterS View Post
    Quick compiling on Linux:

    * Rename the plugin name in plugin.c to something suitable, just to make sure it's your plugin which gets loaded.
    * From the plugin SDK src/ directory, where the demo plugin code is located:

    $ gcc -c -O2 -Wall -fPIC -DLINUX -I../include plugin.c
    $ gcc -o libmyts3_plugin.so -shared plugin.o

    * copy libmyts3_plugin.so to the plugins directory of your TS3 installation
    * run TS3 and enable your new plugin

    I suppose adding a Makefile to plugin SDK for Linux should be a good plan. Still it shouldn't be difficult to write one yourself with the above information.
    You have a simple command line option like this for a mac? I'm not a mac user but have access to a G4 for making my plugin for that platform. I know that gcc is supporting in Mac OSx after installing Xcode, just not sure the right commands to use to make the *.86 and *.ppc files then how to put them into the *.dylib file.
    Last edited by Screech; 11-12-2010 at 20:09.

  5. #5
    Join Date
    Jun 2008
    Location
    Krün, Germany
    Posts
    464
    Building on Mac OS X is basically the same as on Linux. To create an universal binary for both the Intel and PPC architecture you build the library twice for i386 and ppc and then pack them together using the "lipo" command.

    Compile for i386 using the -arch flag
    $ gcc -c -O2 -Wall -fPIC -DMAC -I../include plugin.c -arch i386

    Create the shared library for i386:
    $ gcc -o libmyplugin_i386.dylib -shared plugin.o -arch i386

    Now the same for PPC:
    $ gcc -c -O2 -Wall -fPIC -DMAC -I../include plugin.c -arch ppc
    $ gcc -o libmyplugin_ppc.dylib -shared plugin.o -arch ppc

    Now you have two shared library files for each architecture: libmyplugin_i386.dylib and libmyplugin_ppc.dylib. You can check the architecture with:

    $ lipo -info libmyplugin_i386.dylib
    $ lipo -info libmyplugin_ppc.dylib

    Create an universal library from the two shared libarary files:
    $ lipo -create -o libmyplugin.dylib libmyplugin_i386.dylib libmyplugin_ppc.dylib

    Now you have one universal binary file libmyplugin.dylib containing both shared libraries for i386 and ppc, which you can distribute.

    Final check:
    $ lipo -info libmyplugin.dylib

  6. #6
    Join Date
    May 2007
    Location
    Eastern NC
    Posts
    1,378
    Thank you. Will try it this evening after work.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [Offline] My Now Playing Plugin
    By 4nt1h4cker in forum Plugins
    Replies: 203
    Last Post: 27-01-2012, 08:43
  2. SirReal's G15 plugin
    By SirReal in forum [TeamSpeak 2] Addons & Scripts
    Replies: 147
    Last Post: 21-06-2011, 10:42
  3. Replies: 17
    Last Post: 27-10-2010, 15:32
  4. Plugin SDK <-> Lua Plugin
    By Neico in forum Plugins
    Replies: 0
    Last Post: 20-12-2009, 21:54
  5. An idea for gameserver plugin - comments?
    By [PWG] Tackdriver in forum [TeamSpeak 2] Addons & Scripts
    Replies: 7
    Last Post: 15-04-2007, 19:01

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •