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.

PureGDK / Trying to make Plug-in for DarkData

Author
Message
slyvnr
14
Years of Service
User Offline
Joined: 2nd Nov 2009
Location: Texas
Posted: 29th Jul 2010 18:45 Edited at: 29th Jul 2010 20:57
First, I have ZERO, NADA, No experience in working with .dll's at this level. So if my questions are really really basic and stupid, please accept my apologies upfront as I try to learn this.
---------------------------------------------------------------
I just purchased DarkData and am trying to make a plug-in for PureGDK.

Given that this is a licensed Plug-in for DBPro I opened the file in NotePad++ and could only find the following similar text elements for the procedures.


Following the PureGDK Plugin tutorial I would have expected to see some of these with
Quote: "@@YAXHH@Z"

or
Quote: "@@YAXHHK@Z"


Therefore the line
Quote: "KFS Reindex%LLS%KFSReindex%"

should look something like this:
Quote: "KFS Reindex%LLS%?_KFSReindex@@YAXHHK@Z%Param1, Param2, Param3.s"


Am I headed in the right direction?

Also the portion ?_KFSReindex in the above is this how I would then call the function in PureBasic as in:
Quote: "KFSReindex(1,1,"Name")"


Just wondering then, at this point could I "Rename" functions if I wanted to? For Example taking the above and "renaming"
Quote: "KFS Reindex%LLS%?_dbReindex@@YAXHHK@Z%Param1, Param2, Param3.s"

could then be called in PureBasic like this:
Quote: "dbReindex(1,1,"Name")"

is that even valid?

Thanks again as I try to figure this out.

Slyvnr

Slyvnr
slyvnr
14
Years of Service
User Offline
Joined: 2nd Nov 2009
Location: Texas
Posted: 29th Jul 2010 20:52 Edited at: 29th Jul 2010 21:15
Studying the Tutorial more and looking at what I have got I think I got part of the above post backwards.

When asking about renaming the proceudres it looks to me like I would rename it from the first instance and not the embedded (second) instance.

Therefore:
Quote: "KFS Reindex%LLS%?_KFSReindex@@YAXHHK@Z%Param1, Param2, Param3.s"

would be re-written as
Quote: "dbReindex%LLS%?_KFSReindex@@YAXHHK@Z%Param1, Param2, Param3.s"


where dbReindex = PureBasic Call
and KFSReindex is the Function/Procedure in the DLL
and called from Purebasic using
Quote: "dbReindex(1,1,"Name")"


I also think I have decoded he @@YAXHHK stuff.

Basically there should be @@YAX after the actual procedure name in the DLL where you substitute the following letters based on the [%LLSL portion.

Please correct me if I am wrong.

If I have [%LLSL% then the following would be true.
[%L tells me that a Long is returned [ indicating the procedure returns a value and the first L after the % indicating that it is a long value.

The LSL portion indicates that 3 parameters are required. (L)ong (S)tring (L)ong. (Would have to look at documentation to determine required versus optional and incorporate as required).
Therefore the @@YAX would need to be @@YAXHHK@Z where H substitutes for L and K substitutes for S in the [%LLSL%.

Correct?

Further M substitues for (F)loat in these series?
What substitutes for (O) and (R) in the series?

Finally is the @Z required and what does it indicate?

After the @Z I would then place another % and then followup with the names and types of the passed parameters.

Starting with
Quote: "KFS Reindex%LLS%KFSReindex%"

I would convert it to
Quote: "KFSReindex%LLS%?_KFSReindex@@YAXHHK@Z%FileNumber, IndexNumber, IndexName.s"

Since both the FileNumber and IndexNumber are longs I do not need to place .l after them.

Correct?

What is the purpose of the ?_ ?

Thanks Again

My head is starting to hurt and I think I am getting double vision.

Slyvnr

Slyvnr
Mistrel
Retired Moderator
18
Years of Service
User Offline
Joined: 9th Nov 2005
Location:
Posted: 2nd Aug 2010 10:04
I have no tested it but this should be correct:

Quote: "KFSReindex%LLS%KFSReindex%FileNumber, IndexNumber, IndexName.s""


The exported function is "KFSReindex". You only need the "@" garbage if it's actually part of the export.

You can see exactly what was exported by dropping the dll into dependency walker:

http://www.dependencywalker.com/

The final function will look like this:

Quote: "KFSReindex(FileNumber, IndexNumber, IndexName.s)"


slyvnr
14
Years of Service
User Offline
Joined: 2nd Nov 2009
Location: Texas
Posted: 3rd Aug 2010 02:04 Edited at: 3rd Aug 2010 02:05
Thanks for the response.

I finally got it to recognize the file but get the following:

Initializing full parser ..
Found command dfscreate at line 16
Compiling DarkBasic Professional executable..
Error: Could not understand command at line 29.
Error: Resolving source library..
Error: Attempted use a command from dependency list Lib-P_DarkKFS.gde but the library was not found.




I dragged my Lib-P_DarkKFS.gdt to the GDKLib Builder.exe in the PureGDK\Plugin-sdk folder which created Dependencies and Sources Folders. I copied the Lib-P_DarkKFS.gde file to the PureBasic\PureGDK\Commands Folder

I then loaded the Lib-P_DarkKFS.pb into PureBasic and ran Tailbite.

I wrote my code (above) and it would never start the PureGDK pre-compiler. I inserted calls to open a "DarkBasic Window" (first 6 lines) and the pre-compiler loaded and gave the above error.

Thanks for any input.

Slyvnr

Slyvnr
Mistrel
Retired Moderator
18
Years of Service
User Offline
Joined: 9th Nov 2005
Location:
Posted: 4th Aug 2010 10:04 Edited at: 4th Aug 2010 10:05
Sorry for getting back so late. I've subscribed to the thread so I'll get a notification if you still need help with this.

The error "the library was not found" means that you attempted to use the plugin listed in the .gde file (whatever you have listed there) but the DLL could not be found.

Did you copy the plugin to the PureGDK plugins folder? PureGDK copies your existing plugins from your DarkBasic Professional folder during installation-- it does not "share" the same folder.

Unless you specified a different location during installation, your PureGDK compiler folder is located in "%appdata%\PureGDK", you can drop that location right into the address bar of any folder to navigate there, minus the quotes.

Reinstalling PureGDK is also a quick way of getting plugins copied over. It should prompt you about this during installation.

slyvnr
14
Years of Service
User Offline
Joined: 2nd Nov 2009
Location: Texas
Posted: 5th Aug 2010 03:28
First, Thank you for your assistance.

Second, I apologize myself as I have been trying every conceivable combination of placement of the .DLL file.

I have reinstalled PureGDK since installing the DarkData (dll name is DarkKFS.dll)

DLL is in the C:\ProgramData\PureGDK\plugins-licensed folder.

There is no %appdata%\PureGDK folder I made one and tried copying the DarkKFS.DLL file into that folder into a \plugins sub-folder to that, into a \plugins-licensed sub-folder into a \plugins-user sub-folder.

I also copied it into the C:\ProgramData\PureGDK\plugins and C:\ProgramData\PureGDK\plugins-user folders without luck.

All of my licensed plugins are in the C:\ProgramData\PureGDK\plugins-licensed folder to start with.

I am under Windows 7 (64-bit). I have also tried putting the dll in the same folder as the test program.

All of the "regular" plugins that are listed as supported by PureGDK do work just fine so they are in the right places.

The only thing I can see is when I do the install of the PureGDk it does the Darkbasic Activation window which I cancel out of since there is no activation license number under the "My Account" serial numbers or activation keys pages on the TGC website.

There is a certificate for DarkKFS/DarkData does there need to be one for PureGDK? Would not think so since the other plugins work.

Thanks for any help.


Slyvnr

Slyvnr
Mistrel
Retired Moderator
18
Years of Service
User Offline
Joined: 9th Nov 2005
Location:
Posted: 5th Aug 2010 03:32
Yes, an important detail. You'll need to copy the certificate over as well.

If the plugin can't be validated with the certificate then it won't work and you will get an error about the library not being found. There is no way to differentiate between a missing or unlicensed library at compile time.

This might fix it. Let me know how it goes.

slyvnr
14
Years of Service
User Offline
Joined: 2nd Nov 2009
Location: Texas
Posted: 5th Aug 2010 04:24
All of my plugins have valid certificates in the right folder.

There is no certificate for PureGDK.

Your installed products are Dark Basic Professional (valid certificate)
Advanced Terrain (valid certificate)
Advanced Physics (PC) (valid certificate)
DarkBasic Professional Extends (valid certificate)
Dark Physics (valid certificate)
Dark AI (valid certificate)
Dark Lights (valid certificate)
Dark Ink (valid certificate)
Green Ear (valid certificate)
DarkNet (valid certificate)
DarkKFS (valid certificate)


No idea what is going on. Thanks for all the help tho.

I think I will do other things and come back to this at a later date. Might need to do a complete wipe and reinstall of everything. It seems to be looking in the right areas since it finds all of the other Plugins without problems.

Again thanks.

Slyvnr

Slyvnr
Mistrel
Retired Moderator
18
Years of Service
User Offline
Joined: 9th Nov 2005
Location:
Posted: 5th Aug 2010 04:31 Edited at: 5th Aug 2010 04:33
Are you running the certificate viewer from the DarkBasic Professional folder or the PureGDK application data folder?

If you're having trouble getting the directories and the folders right the easiest way to make sure that PureGDK has the same plugins and licenses is to uninstall PureGDK and DBP. Then install DBP, install and license your plugins, then run the PureGDK installer. It will prompt you to copy your existing plugins and licenses over to PureGDK.

Also, it's best to use the default directories listed in the installer. For example, "%appdata%\PuregDK" would then work so it will be easier to find the right folder.

I think the problem here is that you're mixing up which folder goes with PureGDK and which goes with DarkBasic Professional.

A very long time ago PureGDK shared the same folder. But now it copies the files it needs during installation instead to its own folder. The structure looks very similar so they can be easily confused.

slyvnr
14
Years of Service
User Offline
Joined: 2nd Nov 2009
Location: Texas
Posted: 5th Aug 2010 04:47
The certificate viewer that I ran and posted above was in the C:\Users\Kevin\AppData\Roaming\PureGDK which is the %appdata%\PureGDK folder.

In relation to making sure it is in the right folder, yes I have gone through both sets of folders making sure everything is correct/duplicated/the same.

When I did a reinstall of PureGDK yesterday and earlier this evening I ran it for "All Users" and "Single Users".

All Users puts the PureGDk folder in the C:\ProgramData\PureGDk where as installing for "just this user" puts it into %appdata%\PureGDk folder.

I have made sure they are all the same so that it would find it regardless of where it was looking.

By the way, I did a reinstall of just DBPro and all the plugins and PureGDK yesterday. I think I might need to reinstall PureBasic V4.31 + DBPro + all the Plugins and then PureGDK.

When I did the reinstall it did copy the DarkKFS.DLL over with the other licensed .DLL's and the certificate but it still does not find it.

When I was asking about certificates above I was referring to PureGDK. Does it need a certificate because it is the only "plugin" that does not have it. I would assume that it does not given that it works fine with the other plugins without problems.

Again, thanks for all the suggestions. It is really nice to have the PureGDK to use in PureBasic.

Slyvnr

Slyvnr
Mistrel
Retired Moderator
18
Years of Service
User Offline
Joined: 9th Nov 2005
Location:
Posted: 5th Aug 2010 04:54
E-mail me your .gde file to support@puregdk.com and I will have a look. I'm fairly certain this is just a misconfiguration.

slyvnr
14
Years of Service
User Offline
Joined: 2nd Nov 2009
Location: Texas
Posted: 5th Aug 2010 21:26
OK so made a single change to the gde file and now it works

Replaced the first line
DFS ADD 1
to
DFS FINISH 1

At which point the program starts working. So all of the files were in the correct place, all the certificates were correct the Tailbite-ing of the sources.pb worked it was just a matter of the PureGDK being able to find the .dll based on the first line of the gde.

I will post in the next few days a "Tutorial" of the process that I followed (mimic's the PureGDK.CHM files tutorial) but will be a more step-by-step with screenshots.


Again, thanks for all the help Mistrel

Slyvnr

Slyvnr

Login to post a reply

Server time is: 2024-04-19 19:32:20
Your offset time is: 2024-04-19 19:32:20