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 / Purebasic CDLLs to DBPro plugin and passing pointers to memblocks in and out of that.

Author
Message
Duffer
21
Years of Service
User Offline
Joined: 9th Feb 2003
Location: chair
Posted: 23rd Nov 2014 12:08 Edited at: 23rd Nov 2014 12:09
Does anyone know how to pass pointers to DBPro memblocks in and out of Purebasic CDLLs? Would come in darned handy for me at the moment and save a much slower work around...

As ever a working code (in Purebasic) example would be gratefully received...

a long time dabbler with DBC and DBPro with no actual talent but lots of enthusiasm...
Freddix
AGK Developer
21
Years of Service
User Offline
Joined: 19th Sep 2002
Location: France
Posted: 23rd Nov 2014 13:16
In fact, you need to know how to pass pointer in and out of purebasic CDLLs? Right ?
Duffer
21
Years of Service
User Offline
Joined: 9th Feb 2003
Location: chair
Posted: 23rd Nov 2014 13:30 Edited at: 23rd Nov 2014 14:09
@ Freddix,

Great to hear from you!

Yes, I'm wanting to pass the (DBPro) pointer (to a Memblock) into a ProcedureCDLL within Purebasic... and perhaps how to pass the pointer back out of a PureBasic CDLL as well...?

so let's say in DBPro I've used a pp1 as dword, pp1 = get memblock pointer(1). Where from there?

[edit] using the above example - when you're passing the memblock pointer in to the command you've late created in PureBasic for DBPro, so when using the resultant created DBPro command, do you pass in the pp1 pointer as pp1 or *pp1?

a long time dabbler with DBC and DBPro with no actual talent but lots of enthusiasm...
Duffer
21
Years of Service
User Offline
Joined: 9th Feb 2003
Location: chair
Posted: 26th Nov 2014 23:18
anyone?

a long time dabbler with DBC and DBPro with no actual talent but lots of enthusiasm...
Freddix
AGK Developer
21
Years of Service
User Offline
Joined: 19th Sep 2002
Location: France
Posted: 27th Nov 2014 00:28
Hi Duffer,

In fact, I don't find in my old sources any place where I send a pointer from DarkBASIC Professional to PureBASIC Plugin ..
In fact, with the PurePLUGIN system, I was able to get the pointer to memblock directly from inside the plugin, so, doing what you ask was useless for me

I'll check if I have some free time, how to do that in PureBASIC.

Regards,
Duffer
21
Years of Service
User Offline
Joined: 9th Feb 2003
Location: chair
Posted: 29th Nov 2014 12:17
@ Freddix,

Many thanks for coming back to me on this. As with that pesky String return problemo, I think I have cracked it!

All the best.

a long time dabbler with DBC and DBPro with no actual talent but lots of enthusiasm...
Freddix
AGK Developer
21
Years of Service
User Offline
Joined: 19th Sep 2002
Location: France
Posted: 29th Nov 2014 12:55
String return issue fixed ? Can you tell me more ?
Duffer
21
Years of Service
User Offline
Joined: 9th Feb 2003
Location: chair
Posted: 29th Nov 2014 16:47 Edited at: 29th Nov 2014 16:49
@ Freddix,

You know how everyone was having random crashes with plugins from PureBasic when returning strings or whatever?

Well, I didn't really understand the underlying principles but I stuck at it trying any number of different combinations and eventually found one that seemed totally stable.

So, aside from the ProcedureCDLLs for the commands into DBPro, the capping pb code would look something like this:-



and a ProcedureCDLL.l that would return a string would look something like this:-



So, note the Global OutputString and the Global OutputStringTemp.

Also note, I always now include this at the start of a ProcedureCDLL returning a string:-



And I always end such a ProcedureCDLL as follows:-


Hope that makes some kind of sense.

Bits of it may seem superfluous but with the above, I NEVER get crashes with purebasic derived DBPro plugins with functions returning strings.

a long time dabbler with DBC and DBPro with no actual talent but lots of enthusiasm...
Freddix
AGK Developer
21
Years of Service
User Offline
Joined: 19th Sep 2002
Location: France
Posted: 29th Nov 2014 17:33
Nice Idea, I will check this with some old sources codes I have
Thank you for sharing your tip.
Duffer
21
Years of Service
User Offline
Joined: 9th Feb 2003
Location: chair
Posted: 29th Nov 2014 17:34
Do. For whatever reason, it works, consistently.

a long time dabbler with DBC and DBPro with no actual talent but lots of enthusiasm...
Freddix
AGK Developer
21
Years of Service
User Offline
Joined: 19th Sep 2002
Location: France
Posted: 29th Nov 2014 17:43


I don't know if someday I'll restart coding under DarkBASIC Professional, but in case of, your tip was memorised

Login to post a reply

Server time is: 2024-04-19 08:19:06
Your offset time is: 2024-04-19 08:19:06