I've followed all the de-structions, trying my best to get this working without the need to ask for any help.
I'm trying to put some of my code into a DLL without any joy. Why?
DBP: Test code...
sync off : sync rate 60
Noise Set Params 0, 0.75, 0.01, 1.25, 8, 0
do
for x=0 to 255
for y=0 to 255
v#=Noise Get Height(0,x,y)
if v#<0 then v#=0
v#=v#*255
c=v#
dot x,y,rgb(c,c,c)
next y
next
sync
loop
The C++ (one of the files)...
// DBP-Plugin.cpp : Defines the exported functions for the DLL application.
#include "stdafx.h"
#define EXPORT __declspec ( dllexport )
PerlinNoise pn[7];
EXPORT void PN_Set(int p,float pers,float freq, float ampl,int oct,int seed)
{
pn[p&7].Set(pers,freq,ampl,oct,seed);
}
EXPORT DWORD PN_GetHeight(int p,float x,float y)
{
float hgt=(float)pn[p&7].GetHeight( (double)x,(double)y );
return *(DWORD*)&hgt;
}
The Resource.rc file...
#include "resource.h"
STRINGTABLE
{
IDS_STRING1 "NOISE SET PARAMS[%0LFFFLL%?PN_Set@@YAXHMMMHH@Z%0LFFFLL"
IDS_STRING2 "NOISE GET HEIGHT[%FLFF%?PN_GetHeight@@YAKHMM@Z%FLFF"
}
Each time I fiddle, I compile the dll, open it in notepad, copy the decorated name.
It seems to like the command "NOISE GET HEIGHT" but doesn't like "NOISE SET PARAMS".
"NOISE SET PARAMS" doesn't return a value.
"NOISE GET HEIGHT" returns a float. (I've implemeted the DWORD thingy)
I've got lots more to add to this if I can get this DLL to actually work...
EDIT: I've figured it out...
To set a 'command' instead of a 'function' that returns a value just remove the '[' from the IDS string...
Warning! May contain Nuts!