SRL Archive - Development

Import functions from Simba to .dll


marpis

2010-05-17 06:42:05

I can see how to export functions, that's simple, but how can I import functions and use them in my plugin? Functions like MoveMouse and GetPage etc. that can't be written within the plugin.

Wizzup?

2010-05-17 13:13:26

I am not sure if we have added this yet, what do you need it for? :) (I may know some better alternatives)

Nava2

2010-05-17 19:38:29

If you are making an FPC .dll, why not just import the packages in the units?

marpis

2010-05-18 09:30:36

From: Wizzup?
I am not sure if we have added this yet, what do you need it for? :) (I may know some better alternatives)

Going to make a script with authentication

From: Nava2
If you are making an FPC .dll, why not just import the packages in the units?

wat:bart:

Oh, and the dll will be written in delphi.

Wizzup?

2010-05-18 09:49:50

From: marpis
Going to make a script with authentication


OK, but why do you need Simba functions in a DLL to do authentication?
If you want the script in there entirely, you could also make the form and everything in FPC, andthen use the MML (and possible PS bindings) to make your own .exe. But that's probably more work.

mastaraymond

2010-05-18 09:52:16

From: marpis
Going to make a script with authentication


wat:bart:

Oh, and the dll will be written in delphi.

Means it won't work on other platforms :(

marpis

2010-05-19 03:31:23

From: Wizzup?
OK, but why do you need Simba functions in a DLL to do authentication?
If you want the script in there entirely, you could also make the form and everything in FPC, andthen use the MML (and possible PS bindings) to make your own .exe. But that's probably more work.


I just want to have as much as possible in the plugin. Well, can't call reflection functions ofcourse so they should be the only ones I leave to the Simba-side. I want to call Authenticate() on every function enter on the plugged-in functions, so that someone can't break the authing without rewrite massive codes.

EDIT: It starts to look like it's not possible to call MoveMouse() and GetPage() from a plugin? :(

mastaraymond

2010-05-19 05:24:52

From: marpis
I just want to have as much as possible in the plugin. Well, can't call reflection functions ofcourse so they should be the only ones I leave to the Simba-side. I want to call Authenticate() on every function enter on the plugged-in functions, so that someone can't break the authing without rewrite massive codes.

EDIT: It starts to look like it's not possible to call MoveMouse() and GetPage() from a plugin? :(

Oh it's definitely possible; MoveMouse is already done.. You can do this by passing the TTarget_Exported structure to your plugin (GetKeyMouseTarget)..

About GetPage; you could just make a function in your script and do something like this:

program new;
function GetMyPage(str : string) : string;
begin
result := GetPage(str);
end;
begin
PassToPlugin(@GetMyPage);
end.

Wizzup?

2010-05-19 06:15:08

I'm not sure if ^ is going to work. And if it works, you'll have issues with ShareMem. It would be really be better to make it in FPC. (Really, it isn't any harder than with Delphi)

marpis

2010-05-19 09:03:09

From: mastaraymond
Oh it's definitely possible; MoveMouse is already done.. You can do this by passing the TTarget_Exported structure to your plugin (GetKeyMouseTarget)..

About GetPage; you could just make a function in your script and do something like this:

program new;
function GetMyPage(str : string) : string;
begin
result := GetPage(str);
end;
begin
PassToPlugin(@GetMyPage);
end.


Humm, I really hope I find a good solution for this, cause the getpage part is the most important one :rolleyes:
How come I can't do the TTarget_Exported thing whatever it is to getpage?

mastaraymond

2010-05-19 10:49:10

From: marpis
Humm, I really hope I find a good solution for this, cause the getpage part is the most important one :rolleyes:
How come I can't do the TTarget_Exported thing whatever it is to getpage?

I really don't see why you'd want Simba's GetPage in your script.. :o

Sir R. M8gic1an

2010-05-19 10:53:08

From: mastaraymond
I really don't see why you'd want Simba's GetPage in your script.. :o


I think all he wants is something that'll allow him to connect to a database where he can store users names and pws, to identify them.

~RM

mastaraymond

2010-05-19 10:57:47

From: Rasta Magician
I think all he wants is something that'll allow him to connect to a database where he can store users names and pws, to identify them.

~RM

Yeah, but when you are compiling a dll you could just use any internet component.. And if your making something simple that just requires a GetPage you could just create it in Simba, instead of a dll :p.

Sir R. M8gic1an

2010-05-19 11:04:42

From: mastaraymond
Yeah, but when you are compiling a dll you could just use any internet component.. And if your making something simple that just requires a GetPage you could just create it in Simba, instead of a dll :p.


The point of creating it in a dll is so it will encrypted and not easily crackable, to give him a better chance that people won't just simply remove the auth and distribute his script.

~RM

marpis

2010-05-19 11:27:51

From: mastaraymond
Yeah, but when you are compiling a dll you could just use any internet component.. And if your making something simple that just requires a GetPage you could just create it in Simba, instead of a dll :p.


Yea I know but when I last tried making an authed script with plugins I couldn't get any internet things working :-\ I thought it'd be so much easier to import a function from Simba and use that.

Wizzup?

2010-05-19 11:39:28

From: marpis
Yea I know but when I last tried making an authed script with plugins I couldn't get any internet things working :-\ I thought it'd be so much easier to import a function from Simba and use that.


One thing. If you're going to make a DLL and want it simple, don't use Delphi. FPC and Delphi are _not_ compatible when you want to share stuff like arrays or strings. It will be a true pain.

It should be doable however to use MML components or the MML in it's entirety in plugins. (You'll only have to add it to use uses clause, and Create/Free it.)

nielsie95

2010-05-19 12:51:14

Can you use MML in a closed source plugin?

Wizzup?

2010-05-19 13:29:04

From: nielsie95
Can you use MML in a closed source plugin?


That is another issue… ;)
We _could_ switch to a more liberal license like BSD or LGPL if this becomes an issue. For now, I don't really see the problem if he is experimenting with plugins & MML. In the end, the only ones who can turn it into a problem are we, the developers of the MML…

marpis

2010-05-19 14:31:28

So I should download Free Pascal and make the .dll with it? Will it have internet components as default? Will it be any different than doing it with delphi? Last time I did plugin tests with delphi (simple color finding and TPA things) all went well and I didn't come across any troubles…

nielsie95

2010-05-19 14:37:59

In the worst case you could even clone Simba and hide the editor.

Wizzup?

2010-05-19 15:08:13

From: marpis
So I should download Free Pascal and make the .dll with it? Will it have internet components as default? Will it be any different than doing it with delphi? Last time I did plugin tests with delphi (simple color finding and TPA things) all went well and I didn't come across any troubles…


You should download a recent Lazarus. I think it will have internet components, but otherwise Simba source will have them. I'm sorry to tell you there isn't a tutorial yet on how to use the MML in your own application, but it shouldn't be too hard. You can take a look at this file: http://git.villavu.com/?p=simba.git;a=blob;f=Projects/OCRBench/unit1.pas;h=2bd31e35eb8ba49be841ef8cf694cc169d6fac06;hb=HEAD

Mainly the TClient parts are important. (That and the uses clause)

From: nielsie95
In the worst case you could even clone Simba and hide the editor.


Hehe, that is possible too… I was thinking more of something along the lines of OCRBench.

mastaraymond

2010-05-19 15:09:50

http://villavu.com/forum/showthread.php?t=52873

^ shows a list of Internet components ;). We use Synapse in Simba.