Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DLL Talk / how to use purebasic to build a dll?

Author
Message
bitJericho
22
Years of Service
User Offline
Joined: 9th Oct 2002
Location: United States
Posted: 4th Apr 2011 23:51 Edited at: 4th Apr 2011 23:52
http://forum.thegamecreators.com/?m=forum_view&t=165333&b=18

I've seen the above thread but I'm kind of at a loss on how to use the info. I've got a basic set of procedures set using ProcedureCDLL. I've output it as a .dll file. It needs no dbp libraries and does not required outputting strings, (though strings into the functions will be needed.) Now what do I do with it to make it work in DBP?

Step-by-step guides are appreciated! I guess not required though, any help is great!

[center]
Join the TGC Group!
http://tehcodez.groups.live.com
bitJericho
22
Years of Service
User Offline
Joined: 9th Oct 2002
Location: United States
Posted: 5th Apr 2011 05:27
Nevermind!

This tutorial covered everything I needed to know!

http://www.thegamecreators.com/pages/newsletters/newsletter_issue_22.html

My hat off to Frédéric, which I think is freddix if I'm not mistaken.

[center]
Join the TGC Group!
http://tehcodez.groups.live.com
D Ogre
21
Years of Service
User Offline
Joined: 19th Nov 2003
Location:
Posted: 5th Apr 2011 05:50 Edited at: 5th Apr 2011 05:56
I'm currently working on new wrappers for the DBPro commands and correcting and revising my old information. This is in tandem with a plugin project I have in the works. So, information release will be slow.

If you are not using any DBPro Dependencies, you will probably not need to include the GlobStruct, or use the RecieveCorePtr function. If you need to init/de-init something before your new plugin commands can be used, you will need the Constructor and Destructor compiled in your DLL. The PPFixer utility needs to be used to change any of these functions to a name mangling convention in order for them to work in your compiled plugin DLL.

You will have to build a string table for your DLL. You can either include it under the Resources (.rc file) under the Compiler Options, or use Reshack to incorporate it into the DLL.

If your function simply needs a string passed to it, you just need to pass a long that is a pointer to the string:


Edit:

You posted before I did!

If your referring to the QuickStart Tutorial, then yes Freddix is the author. Lots of basic, but very useful information. However, it is a bit dated in some areas.
bitJericho
22
Years of Service
User Offline
Joined: 9th Oct 2002
Location: United States
Posted: 5th Apr 2011 06:02 Edited at: 5th Apr 2011 06:13
The only thing stopping me is 2 questions:

How can I use overloaded functions?

eg: Procedure myproc(myint.l=500)

And how many assignments can I have in a procedure call?

Ah, one more questions, the way .rc files need to be written:


Where can I aquire winres.h and is that actually needed when compiling in PB?

[center]
Join the TGC Group!
http://tehcodez.groups.live.com
D Ogre
21
Years of Service
User Offline
Joined: 19th Nov 2003
Location:
Posted: 5th Apr 2011 07:12 Edited at: 5th Apr 2011 07:19
If you mean using overloaded functions as they are used in languages like C++, the answer is no. You can simulate this by writing functions that perform the same task, but having different names along with it's parameters. Then give them the same name in the stringtable, but each referencing a different DLL function call and parameter set.

Look at this stringtable from the DBProImageDebug.dll



Observe the Image LOAD/SAVE commands. Each version calls a different function with a different number of parameters.

If you mean initializing a parameter with a value if nothing is passed during the function call, that would be no also. The stringtable tells the DBPro compiler what parameters to expect to see passed to the function in the DLL. If not present in the DBPro code, the compiler will complain.
bitJericho
22
Years of Service
User Offline
Joined: 9th Oct 2002
Location: United States
Posted: 5th Apr 2011 07:16 Edited at: 5th Apr 2011 07:19
Ok. So how does one use an rc file? ah nm, looks like it doesn't need the reference ti winres.h

[center]
Join the TGC Group!
http://tehcodez.groups.live.com
Duffer
21
Years of Service
User Offline
Joined: 9th Feb 2003
Location: chair
Posted: 6th Apr 2011 10:08 Edited at: 6th Apr 2011 10:09
@ Jerico2day,

Occurs to me you should be able to make at least some use of the utility program of mine - it creates .rc from YourProcedures.pb file and then ppfixes the original purebasic .dll with the .rc added as a resource, it then creates both .ini keywords file and [sort of] help files - and can shove all in to DBPro as well.... it can cope also with all sorts of things like _ into <space> in commands from .pb to dbpro commands in plugin, optional parameters etc etc - it's really designed for use with Pureplugin but sure you could make some use of it - if nothing else to take the grind out of creating .rc, .ini and basic help files...?

Anyhows, here is the link:-

http://forum.thegamecreators.com/?m=forum_view&t=180153&b=8

a long time dabbler with DBC and DBPro with no actual talent but lots of enthusiasm...
bitJericho
22
Years of Service
User Offline
Joined: 9th Oct 2002
Location: United States
Posted: 7th Apr 2011 20:20
That should help. Thanks

[center]
Join the TGC Group!
http://tehcodez.groups.live.com

Login to post a reply

Server time is: 2024-11-21 15:00:48
Your offset time is: 2024-11-21 15:00:48