does anybody know the c++ equivalent of purebasic's poke string? i want to make a plugin for 3dws but it seems to crash whenever i startup with this plugin.
this is my code using dev c+++
# define DLL_EXPORT extern "C" void __declspec (dllexport)
#ifndef _DLL_H_
#define _DLL_H_
#if BUILDING_DLL
# define DLLIMPORT __declspec (dllexport)
#else /* Not BUILDING_DLL */
# define DLLIMPORT __declspec (dllimport)
#endif /* Not BUILDING_DLL */
#endif /* _DLL_H_ */
/* Replace "dll.h" with the name of your header */
//#include "dll.h"
#include <windows.h>
#include <string.h>
#include <stdio.h>
#if BUILDING_DLL
# define DLLIMPORT __declspec (dllexport)
#else /* Not BUILDING_DLL */
# define DLLIMPORT __declspec (dllimport)
#endif /* Not BUILDING_DLL */
// create some constants for plugin
//Plugin constants
#define PLUGIN_EXPORT 1
#define PLUGIN_IMPORT 2
#define PLUGIN_BRUSHCREATION 4
#define PLUGIN_MESHLOAD 8
//Brush creation parameter constants
#define PLUGIN_BRUSHCREATION_SPINNER 1
#define PLUGIN_BRUSHCREATION_CHECKBOX 2
#define PLUGIN_BRUSHCREATION_COMBOBOX 3
//Map components
#define PLUGIN_BRUSHES 1
#define PLUGIN_MESHES 2
#define PLUGIN_ENTITIES 4
#define PLUGIN_TERRAIN 8
#define PLUGIN_MESHREFERENCES 16
#define PLUGIN_LIGHTMAPS 32
#define PLUGIN_COPYTEXTURES 64
//Classes
#define CLASS_RIGIDBODYREFERENCE 126
#define CLASS_LIMBREFERENCE 101
//Plugin constants
#define PLUGIN_EXPORT 1
#define PLUGIN_IMPORT 2
#define PLUGIN_BRUSHCREATION 4
#define PLUGIN_MESHLOAD 8
//Brush creation parameter constants
#define PLUGIN_BRUSHCREATION_SPINNER 1
#define PLUGIN_BRUSHCREATION_CHECKBOX 2
#define PLUGIN_BRUSHCREATION_COMBOBOX 3
//Map components
#define PLUGIN_BRUSHES 1
#define PLUGIN_MESHES 2
#define PLUGIN_ENTITIES 4
#define PLUGIN_TERRAIN 8
#define PLUGIN_MESHREFERENCES 16
#define PLUGIN_LIGHTMAPS 32
#define PLUGIN_COPYTEXTURES 64
//Classes
#define CLASS_RIGIDBODYREFERENCE 126
#define CLASS_LIMBREFERENCE 101
#include <windows.h>
using namespace std;
int WINAPI DllMain( HINSTANCE hModule, DWORD fdwReason, LPVOID lpvReserved )
{
if ( fdwReason == DLL_PROCESS_ATTACH ) {
// initialize anything nessasary at DLL load.
} else if ( fdwReason == DLL_PROCESS_DETACH ) {
// cleanup anything on dll unload.
}
return true;
}
DLL_EXPORT PluginDescription( int *inbuffer, int insize, int *outbuffer, int outsize )
{
static char desc[] = "exports a WAD file for use with darkbasic pro";
memcpy(outbuffer,"exports a WAD file for use with darkbasic pro",sizeof(desc)+1);
}
DLL_EXPORT PluginClass( int *inbuffer, int insize, int *outbuffer, int outsize )
{
char output = 1;
memcpy(outbuffer, &output,sizeof(char)+1);
/*
void FuncName(char *whatever)
{
//Poking a string may refer to doing:
memcpy(whatever,6 size of the string Hello , "Hello");
}
*/
}
DLL_EXPORT PluginLabel( int *inbuffer, int insize, int *outbuffer, int outsize )
{
static char desc[] = "wad file format (.wad)";
memcpy(outbuffer,"wad file format (.wad)",sizeof(desc)+1);
}
DLL_EXPORT PluginFileExtension( int *inbuffer, int insize, int *outbuffer, int outsize )
{
static char desc[] = "*.wad";
memcpy(outbuffer,"*.wad",sizeof(desc)+1);
}
DLL_EXPORT PluginExportParameters( int *inbuffer, int insize, int *outbuffer, int outsize )
{
char output = 1;
memcpy(outbuffer,&output,sizeof(char));
}
DLL_EXPORT PluginExport( int *inbuffer, int insize, int *outbuffer, int outsize )
{
}