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 / Getting a Function Number within an Include File

Author
Message
MSon
20
Years of Service
User Offline
Joined: 13th Jul 2004
Location: Earth, (I Think).
Posted: 2nd Feb 2008 11:06 Edited at: 2nd Feb 2008 11:16
I've managed to script 99% of DarkBasic Commands and all my Plugin Commands using the new Lua Script DLL for use in my project, but have had to place all my Functions for this at the top of my main source, is there any way i can add them into an include file and just search for the first function number inside that include file?

i need this or else im stuck with my main source having 8000 aditional lines at the start which would be better hidden in an include file as i won't need to edit them.

is there any DLL that will be abl to find a function number inside an include?

I was unsure which board to place this in, but as its for use with the Lua DLL, and i would proberley need a DLL to locate this information, i figured this would be tyhe nbest place, sorry if wrong

Everyone Be Cool, You, Be Cool.
MSon
20
Years of Service
User Offline
Joined: 13th Jul 2004
Location: Earth, (I Think).
Posted: 2nd Feb 2008 11:15 Edited at: 2nd Feb 2008 11:15
PS: Example of my Lua Function Calls inorder to gain access to DBPro and DLL Commands.



Everyone Be Cool, You, Be Cool.
IanM
Retired Moderator
22
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 2nd Feb 2008 12:16
There's no 'one command' method to do it, but yes it can be done.

Write a function placed immediately before the functions you wish to pass to LUA. This function will then get it's own pointer (GET PTR TO THIS FUNCTION) and then search through the numbered functions until it finds that pointer. Once it has found its number, you can increment by 1 and use that as the number for the next function, repeating until you have all of your functions registered:


Barnski
18
Years of Service
User Offline
Joined: 26th Jan 2006
Location: Switzerland, Zurich
Posted: 2nd Feb 2008 16:07
hi,
just wanted to point out that the last parameter of LUA REGISTER FUNCTION should be 1 if you want to register a dbpro plugin or dbpro dll command. Thats because of the string pointer passed as first argument if the function returns a string. If you register a dbpro user function or an arbitrary dll function, then use 0.
Besides, if the stringtable of the plugin/dll is unencrypted, you can directly register all functions of a dll by using the LUA REGISTER DLL command.
But your way is fine too!

MSon
20
Years of Service
User Offline
Joined: 13th Jul 2004
Location: Earth, (I Think).
Posted: 2nd Feb 2008 22:49 Edited at: 2nd Feb 2008 22:57
Thanks Ian, i'll have a look at that

Barnski
i just wrote some code to export the entire keywords folder so it placed 0 by default

i thought you only had to use a last paramiter of 1 if you where trying to register a non standard DLL Command direct, but im running every command through a function, therefor registering a function, not the dll command.

i've had to do it this way as in my programme i need to know if any new gui items/alterations have been made, if its through functions, then you can just add your own system to store the information when the darkbasic or blue command is called.
as its through functions, would a last paramiter of 0 always apply?

Edit: just read responce on your thread

Everyone Be Cool, You, Be Cool.
Barnski
18
Years of Service
User Offline
Joined: 26th Jan 2006
Location: Switzerland, Zurich
Posted: 3rd Feb 2008 02:07
Oh sorry MSon, you are right. I see now what you are doing, nice indeed. And the last parameter shall be 0 then, since you register your user functions. All right then! (it would have to be 1 if you called the dbpro commands directly).

Diggsey
18
Years of Service
User Offline
Joined: 24th Apr 2006
Location: On this web page.
Posted: 3rd Feb 2008 12:26
Or you could use my AddressOf precompiler, and just use the function name instead of its number

MSon
20
Years of Service
User Offline
Joined: 13th Jul 2004
Location: Earth, (I Think).
Posted: 10th Feb 2008 17:43
hi Diggsey

im looking for that AddressOf dll, but its not on your website, anyone got it?

Everyone Be Cool, You, Be Cool.
IanM
Retired Moderator
22
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 10th Feb 2008 23:39
That's because it's a precompiler (ie you feed your code through it before passing the result to the DBPro compiler).

Diggsey posted the code in my utility thread, sometime around October and just before the convention.

Diggsey
18
Years of Service
User Offline
Joined: 24th Apr 2006
Location: On this web page.
Posted: 11th Feb 2008 19:20
MSon
20
Years of Service
User Offline
Joined: 13th Jul 2004
Location: Earth, (I Think).
Posted: 12th Feb 2008 00:04
Thanks, ill take a look at that.

and Nice GuiEditor, Im making somethink like that in my current project but for use with BlueGui.

Everyone Be Cool, You, Be Cool.

Login to post a reply

Server time is: 2024-10-18 07:56:52
Your offset time is: 2024-10-18 07:56:52