Page 2 of 2
Posted: Fri Apr 21, 2006 7:03 am
by netmaestro
@josku_x, that idea appealed to me for a while too until I tripped over a problem with it. I'm programmer #1, I make a dll that checks if a registered version of PB is present before it will perform its functions. I distribute it to programmer #2, who owns PureBasic, he includes it in his program and compiles it. All works fine until he sells his finished exe on Shareware.com and an end-user downloads it and tries to run it. Oops - the user doesn't own Purebasic - crash. Right?
Posted: Fri Apr 21, 2006 8:36 am
by blueznl
josku_x wrote:
There is a DOWN side:
If you publish the PB source, some users in this forum could just make a DLL of it by replacing all Procedure to ProcedureDLL.
they could always do it, simply write a wrapper for your dll, and compile the result as a new dll, done
(in fact, i'm not hot on libraries, but i've tried this approach to see if i could turn a lib into a dll so i could use it with any version of purebasic, and lo and behold, that worked... so if you're stuck on a 3.94 lib, and it's nature allows you to wrap it, turn it into a new dll and you're ready for pb4... not as convenient, i know... then again, use includes and source, not libs / dll's!)
i would stick to source and not even bother
Posted: Fri Apr 21, 2006 4:31 pm
by josku_x
@netmaestro: I know, but anyways the author of this topic wants that only PB users can use the DLL, so it doesn't matter that my solution sux.
Posted: Mon Apr 24, 2006 2:13 am
by ricardo
Why just PB users???
There is NO way to stop someone using not PB to use your dll if they really want to.
but, does this dll has some really amazing features that make really possible that people do a lot to run ti? Then i go back to my first question: why limit some dll just to PB users?
Re: ...
Posted: Mon Apr 24, 2006 2:16 am
by ricardo
roblos wrote:Well my main concern is that I'm not allowed to create PB dlls that use high level PB commands for other languages so I wanted a way to keep it legal.
I think you are wrong.
You CAN use highlevel commands in your dll, what you CAN'T do is that just make a wrapper to that high_level commands. Its not the same...
Anyway, NO PB user will want a dll that is JUST a wrapper of PB high level commands... so it makes no sense for me.
Posted: Mon Apr 24, 2006 2:17 am
by Dare2
roblos was just trolling ...
Re: ...
Posted: Mon Apr 24, 2006 11:20 pm
by roblos
Hallo and thanks all for your replies. Sorry if I did not thank you promptly.
Well I don't know whether it works or not, but my solution is to create a userlib for PureBasic with a new command to initialize the dll before using it, so that only someone that has PureBasic can use it. I remember someone already suggested me this solution. I still have not tried it myself because I was not successfull in creating a user library for PB
ricardo wrote:You CAN use highlevel commands in your dll, what you CAN'T do is that just make a wrapper to that high_level commands. Its not the same...
Once I asked Fred if I could use PureBasic to create something that makes games, such an RPG MAKER, for example. And well before starting that I wanted to use PureBasic to create a dll and provide a gui functionality to other languages (DarkBASIC Pro or Blitz 3D).
Well after so much talking (you can find my post somewhere in the forums), Fred wrote: "As long you use the PB high level commands to manage your things for your own langage/game creator etc, it's forbidden."
My question was about a generic dll...I mean even a dll I could use for a RPG MAKER and I asked it in order to create something it could be used by me, in my software, or by PureBasic users, not by someone else, so that at least there was no complaint from PureBasic team. Well hope my explanation is clear.
Thanks again all for your replies,
Roberto
Re: ...
Posted: Mon Apr 24, 2006 11:40 pm
by roblos
By the way, is it my impression or are some posts in this topic disappearing?
I got an automatic reply:
"You can use the following link to view the replies made, no more notifications will be sent until you visit the topic.
http://www.purebasic.fr/english/viewtop ... 866#140866"
but the post does not exist and I remember there were other messages I wanted to reply, but I can't see them anymore....maybe deleted by the author? or what?
See you all,
Roberto
Posted: Mon Apr 24, 2006 11:45 pm
by netmaestro
The library idea is a good one, it just needs one wrinkle: it has to test if it's being run from a dll or toplevel process. I'm going to look at a good way to do that and see if I can come up with something. If so it should be a reasonable solution.
...
Posted: Mon Apr 24, 2006 11:52 pm
by roblos
Hi Netmaestro and thanks for your comments.
I was thinking of something like this:
For example the dll I want to create is MyDll.dll, which contains a function RegisterDll (String$) to set the variable DllRegistered$ to "TRUE" and if DllRegistered$ = "TRUE" then you can use all the other functions of MyDll.dll, otherwise you will get a message box "This dll has not been registered". Of course the String$ passed as a parameter in RegisterDll can have only one valid value and I use to send an encrypted string.
The new PB command is InitializeMyDll. InitializeMyDll will simply call RegisterDll with the required String$.
Well if you can create an example in C, it would be fine as I couldn't
Do you think there might be any problems or hacking? if so what kind?
Roberto
Posted: Tue Apr 25, 2006 12:00 am
by netmaestro
I have an idea for a complex structure to be used as a key. I'll post when I get something that looks reasonable.
Posted: Tue Apr 25, 2006 7:27 am
by josku_x
I think many new users are getting a wrong idea of what means a 'wrapper'.
Here's an example of a 'wrapper' dll, that Fred DOES
NOT want that you distribute it:
Code: Select all
ProcedureDLL PureBasic_MessageBox(Title$, Text$, Flags)
MessageRequester(Title$, Text$, Flags) ; <-- You see?
EndProcedure
In that above example I just made a procedure that calls a PureBasic procedure. THis means it is a wrapper and what can you do with a wrapper? 1) You can extend the abilities of a sloppy programming language. And because of this, Fred doesn't want that people make PB wrappers, or else, you would only download a free copy of let's say Game Maker just to use the PB commandset, where the PB Team made a lot of hardwork.
However, a workaround to avoid wrapper's is to use API:
Code: Select all
ProcedureDLL My_MessageBox(Title$, Text$, Flags)
MessageBox_(0, Text$, Title$, Flags) ; <-- See? API instead of PB commands = not a wrapper.
EndProcedure
I think this is now cleared, but there is one thing left to explain:
You CAN use PureBasic commands in your dlls, but ONLY if you don't make a wrapper. Like, this is allowed to do:
Code: Select all
ProcedureDLL OpenWebpage()
In$=InputRequester("Open a Webpage.", "Enter an URL.", "http://")
RunProgram(In$)
EndProcedure
As you see that's not a wrapper, but a procedure which uses PB commands. But remember that it is always better to use a mixture of PB and API commands, so I would do the above example like this:
Code: Select all
ProcedureDLL OpenWebpage()
In$=InputRequester("Open a Webpage.", "Enter an URL.", "http://")
ShellExecute_(0, "open", In$, "", "", #SW_SHOW)
EndProcedure
I hope that people in the future will understand what Fred is meaning and that they wouldn't think that PB sucks.