Forum


Notice to all users

We are migrating towards a new forum system located at community.teamspeak.com, as such this forum will become read-only on January 29, 2020

Results 1 to 3 of 3
  1. #1
    Join Date
    June 2012
    Location
    here and there..
    Posts
    86

    Question which compiler Oo ?

    I want to creat my own plugin, but one problem is i dont know which compier.
    I tested it with

    Code:
    #include <stdio.h>
    #include <stdlib.h>
    #include <string.h>
    #include <assert.h>
    
    #include <ts3\public_errors.h>
    #include <ts3\public_errors_rare.h>
    #include <ts3\public_definitions.h>
    #include <ts3\public_rare_definitions.h>
    #include <ts3\ts3_functions.h>
    
    #include "plugin.h"
    
    static struct TS3Functions ts3Functions;
    
    
    #define strcpy(dest, destSize, src) { strncpy(dest, src, destSize-1); (dest)[destSize-1] = '\0'; }
    
    
    #define PLUGIN_API_VERSION 19
    
    #define PATH_BUFSIZE 512
    #define COMMAND_BUFSIZE 128
    #define INFODATA_BUFSIZE 128
    #define SERVERINFO_BUFSIZE 256
    #define CHANNELINFO_BUFSIZE 512
    #define RETURNCODE_BUFSIZE 128
    
    static char* pluginID = NULL;
    
    
    /*********************************** Required functions ************************************/
    /*
     * If any of these required functions is not implemented, TS3 will refuse to load the plugin
     */
    
    /* Unique name identifying this plugin */
    const char* ts3plugin_name() {
    	return "Test Plugin";
    
    }
    
    /* Plugin version */
    const char* ts3plugin_version() {
        return "1.2";
    }
    
    /* Plugin API version. Must be the same as the clients API major version, else the plugin fails to load. */
    int ts3plugin_apiVersion() {
    	return PLUGIN_API_VERSION;
    }
    
    /* Plugin author */
    const char* ts3plugin_author() {
    	/* If you want to use wchar_t, see ts3plugin_name() on how to use */
        return "TeamSpeak Systems GmbH";
    }
    
    /* Plugin description */
    const char* ts3plugin_description() {
    	/* If you want to use wchar_t, see ts3plugin_name() on how to use */
        return "This plugin demonstrates the TeamSpeak 3 client plugin architecture.";
    }
    
    /* Set TeamSpeak 3 callback functions */
    void ts3plugin_setFunctionPointers(const struct TS3Functions funcs) {
        ts3Functions = funcs;
    }
    
    /*
     * Custom code called right after loading the plugin. Returns 0 on success, 1 on failure.
     * If the function returns 1 on failure, the plugin will be unloaded again.
     */
    int ts3plugin_init() {
        char appPath[PATH_BUFSIZE];
        char resourcesPath[PATH_BUFSIZE];
        char configPath[PATH_BUFSIZE];
    	char pluginPath[PATH_BUFSIZE];
    
        /* Your plugin init code here */
        printf("PLUGIN: init\n");
    
        /* Example on how to query application, resources and configuration paths from client */
        /* Note: Console client returns empty string for app and resources path */
        ts3Functions.getAppPath(appPath, PATH_BUFSIZE);
        ts3Functions.getResourcesPath(resourcesPath, PATH_BUFSIZE);
        ts3Functions.getConfigPath(configPath, PATH_BUFSIZE);
    	ts3Functions.getPluginPath(pluginPath, PATH_BUFSIZE);
    
    	printf("PLUGIN: App path: %s\nResources path: %s\nConfig path: %s\nPlugin path: %s\n", appPath, resourcesPath, configPath, pluginPath);
    
        return 0;  /* 0 = success, 1 = failure, -2 = failure but client will not show a "failed to load" warning */
    	/* -2 is a very special case and should only be used if a plugin displays a dialog (e.g. overlay) asking the user to disable
    	 * the plugin again, avoiding the show another dialog by the client telling the user the plugin failed to load.
    	 * For normal case, if a plugin really failed to load because of an error, the correct return value is 1. */
    }
    
    /* Custom code called right before the plugin is unloaded */
    void ts3plugin_shutdown() {
        /* Your plugin cleanup code here */
        printf("PLUGIN: shutdown\n");
    
    	/*
    	 * Note:
    	 * If your plugin implements a settings dialog, it must be closed and deleted here, else the
    	 * TeamSpeak client will most likely crash (DLL removed but dialog from DLL code still open).
    	 */
    
    	/* Free pluginID if we registered it */
    	if(pluginID) {
    		free(pluginID);
    		pluginID = NULL;
    	}
    }
    
    /****************************** Optional functions ********************************/
    /*
     * Following functions are optional, if not needed you don't need to implement them.
     */
    
    
    /*
     * If the plugin wants to use error return codes, plugin commands, hotkeys or menu items, it needs to register a command ID. This function will be
     * automatically called after the plugin was initialized. This function is optional. If you don't use these features, this function can be omitted.
     * Note the passed pluginID parameter is no longer valid after calling this function, so you must copy it and store it in the plugin.
     */
    void ts3plugin_registerPluginID(const char* id) {
    	const size_t sz = strlen(id) + 1;
    	pluginID = (char*)malloc(sz * sizeof(char));
    	strcpy(pluginID, sz, id);  /* The id buffer will invalidate after exiting this function */
    	printf("PLUGIN: registerPluginID: %s\n", pluginID);
    }
    
    /* Plugin command keyword. Return NULL or "" if not used. */
    const char* ts3plugin_commandKeyword() {
    	return "test";
    }
    but If I compil it with Code::Blocks 12.11 Compiler: GNU GCC Compiler,
    I get this file.

    but in teamspeak 3 -> plugins
    I says "Failed to open plugin."

    I use win 7 64 bit and have no Idea where is my misake ^^

    Greetz

  2. #2
    Join Date
    January 2010
    Location
    Germany
    Posts
    91
    This is just guessing but Code::Blocks will most likely create a 32bit dll by default, which cannot be loaded by the 64bit TS3 client. You have to either tell your compiler to create a 64bit dll (I don't use Code::Blocks, so I can't tell you how) or use the 32bit TS3 client.

  3. #3
    Join Date
    June 2008
    Location
    Krün, Germany
    Posts
    510
    On Windows, the TeamSpeak client is compiled with Microsoft Visual Studio 2008. Loading plugins compiled with gcc will be a challenge on Windows. So far I only did the reverse, loading a MSVC DLL from Mingw exe, and that was quite some fiddling. But a quick google search shows some articles (e.g. here) on loading Mingw DLLs from a MSVC exe, so you may give it a try.

    Instead I would suggest to install Microsoft Visual Studio 2008 Express, which is a free download.

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [Resolved] Best compiler for Teamspeak Plugins?
    By Bluscream in forum Client Plugins / Lua Scripts
    Replies: 4
    Last Post: September 11th, 2015, 06:00 PM
  2. Can't I compile plugin.c with C++ compiler?
    By Pommes in forum Client Plugins / Lua Scripts
    Replies: 3
    Last Post: January 12th, 2010, 03:34 PM

Posting Permissions

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