Hi Sam,
Sorry, I'm even more confused now
If you want to define the input box in a dll, and use it in another executable project, you need two projects. The InputBox project will have one .ec file with the inputbox code (e.g. inputBox.ec).
Code: Select all
import "ecere"
public int InputBox()
{
int num;
FormInteger form{};
incref form;
form.Modal();
num=form.number;
delete form;
return num;
}
class FormInteger : Window
{
caption = "整数:";
background = activeBorder;
borderStyle = fixed;
size = { 368, 148 };
anchor = { horz = -107, vert = -153 };
public:
int number;
property int number
{
set { number=value; txtNumber.Refresh(); }
get {return number;}
}
Button btnOK
{
this, caption = "OK", altO, isDefault = true, size = { 74, 21 }, position = { 256, 80 };
NotifyClicked = ButtonCloseDialog;
};
Label lblTxtNumber { this, labeledWindow = txtNumber, size = { 140, 13 }, position = { 16, 8 } };
SavingDataBox txtNumber { this, caption = "请输入整数:", data = &number, type = class(int), size = { 326, 19 }, position = { 16, 32 } };
}
The name of the project and the source file could be different, but note that it is the project name (and target dll name) that must be used to import it into your client executable.
Then your project will have one or more file, where you will import the inputbox module where you need it. That project should not have inputbox.ec included in it. (You want to import from the dll, not the .ec file):
Code: Select all
import "ecere"
import "inputBox"
class App : GuiApplication
{
bool Init()
{
InputBox();
return true;
}
}
You will need to copy the built dll to the client project's directory for it to compile (The compiler will load the InputBox.dll when compiling your client code to see what classes/functions are defined in there).
You should never have to write C-style prototype declarations for eC code as in your first code block...
I hope this is clearer
Cheers,
Jerome