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 / DBP Commands

Author
Message
Xarshi
18
Years of Service
User Offline
Joined: 25th Dec 2005
Location: Ohio
Posted: 26th Jun 2006 20:18
Alright. I'm using devc++ as some of you might know. But I got something to get direct x to work with devc++. It works,and I've tested it. But,I'm facing a slight problem. I'm trying to use dbp commands in my dll. So I get the adress of the text function,to test it. It compiles and all,woohoo,but then,when I run the exe,it doesn't load the dll. It says:
failed to load dll(1:FFPSv2.dll)

Why is it doing this?

all ben needs is his band,his guitar,and his computer
EsteemDE
19
Years of Service
User Offline
Joined: 5th Aug 2005
Location:
Posted: 4th Jul 2006 11:01
This could be caused by many different things... you need to tell us more. Have you ever been able to load the DLL? If yes, at what point in development did it stop working? If no, then try making a simple DLL that works first, then add the stuff you want.

I have got that error before. Make sure you are not using anything .Net. Make sure you are only using standard windows DLL's to call functions. If you are using functions from a DLL not included in windows, a windows service pack, or in direct X then it will fail to load. For example if you use a function from a DLL called "mydll1.dll" inside your DBP DLL called "mydbpdll.dll" then "mydll1.dll" will also need to be included. Theres many other reasons it may give you that... and its too many to list.

Current Project - Dark NET System Framework DLL
Percentage - 14%.......Lines of Code - 9,171
This Info Updated - 6/18/06 12:10pm
Xarshi
18
Years of Service
User Offline
Joined: 25th Dec 2005
Location: Ohio
Posted: 4th Jul 2006 15:11
Hm...ok,well,the only time it fails to load the dll is when I use the getProcAdress command. That is the only time. I have sucesfully created plug-ins for dbp before. I can do that easily. So it has to do with globstruct.h more than likely.

all ben needs is his band,his guitar,and his computer
IanM
Retired Moderator
22
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 4th Jul 2006 15:50
You need to ensure that DBPro is including the DLL you are trying to access when it compiles. You do this by simply including a command from that DLL in your DBPro source code.

If you don't, the DLL is not included, and you can't call it.

For free Plug-ins and source code http://www.matrix1.demon.co.uk
Xarshi
18
Years of Service
User Offline
Joined: 25th Dec 2005
Location: Ohio
Posted: 5th Jul 2006 01:16 Edited at: 5th Jul 2006 01:17
Yeah,I think thats probably the problem. Thankyou

all ben needs is his band,his guitar,and his computer
Xarshi
18
Years of Service
User Offline
Joined: 25th Dec 2005
Location: Ohio
Posted: 13th Jul 2006 01:20
When trying to use them,now when compiling,I get a "'GetProcAdress'" was not declared in this scope". What does that mean?

all ben needs is his band,his guitar,and his computer
Three Score
20
Years of Service
User Offline
Joined: 18th Jun 2004
Location: behind you
Posted: 13th Jul 2006 10:24
GetProcAddres is a function to get the address of a dll function so I guess the dll was not found in the namespace

Xarshi
18
Years of Service
User Offline
Joined: 25th Dec 2005
Location: Ohio
Posted: 13th Jul 2006 20:02
oh...yeah...I guess I should've loaded the dll first. lol

all ben needs is his band,his guitar,and his computer
IanM
Retired Moderator
22
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 13th Jul 2006 20:37
Or you could use GetProcAddress instead of GetProcAdress ...

For free Plug-ins and source code http://www.matrix1.demon.co.uk
Xarshi
18
Years of Service
User Offline
Joined: 25th Dec 2005
Location: Ohio
Posted: 23rd Jul 2006 03:19
alright. Still back to square two then,says it can't load the dll. I'm slightly confused about this.

Fear the dwemer pokeballs. Fear them!
IanM
Retired Moderator
22
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 24th Jul 2006 15:07
It's obvoisly something you are doing incorrectly. Save us guessing ... Post code.

For free Plug-ins and source code http://www.matrix1.demon.co.uk
Xarshi
18
Years of Service
User Offline
Joined: 25th Dec 2005
Location: Ohio
Posted: 24th Jul 2006 15:32 Edited at: 24th Jul 2006 16:01
haha,good idea! I'll get it.

Ok,here is the source to simple one. I used someone elses quick setup so it would go faster(deleted my old one but this one still screws up the same way). I'm not sure what I did wrong.

Fear the dwemer pokeballs. Fear them!

Attachments

Login to view attachments
IanM
Retired Moderator
22
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 24th Jul 2006 16:45
Try this - comments have been added. Just search for IRM to see my notes.



NOTE: This code has not been tested, but should work just fine.

You might need to add a leading underscore to your function name in the string resource file if DBPro can't find the function ... I can't remember how Dev-C++ deals with extern C functions.

For free Plug-ins and source code http://www.matrix1.demon.co.uk
Xarshi
18
Years of Service
User Offline
Joined: 25th Dec 2005
Location: Ohio
Posted: 24th Jul 2006 17:19 Edited at: 24th Jul 2006 17:23
Wow. I'm so happy right now its unbelievable. Thankyou so so much!!!!!!! (by the way,it works)

-Edit:
My only question would be this:
how would I make it so I don't have to declare the address of the function each time I use the dbp function again?

Fear the dwemer pokeballs. Fear them!
IanM
Retired Moderator
22
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 24th Jul 2006 19:16
The code already does it.

See the 'static' keyword? When used within a function, it ensures that the variable value is only set once. It basically does the equivalent of this, but automatically:



For free Plug-ins and source code http://www.matrix1.demon.co.uk
Xarshi
18
Years of Service
User Offline
Joined: 25th Dec 2005
Location: Ohio
Posted: 24th Jul 2006 21:50
Oh. I see. Thats very interesting. Thankyou!

Fear the dwemer pokeballs. Fear them!
Xarshi
18
Years of Service
User Offline
Joined: 25th Dec 2005
Location: Ohio
Posted: 24th Jul 2006 22:04
Sorry for the questions,but how would you do the repeat loops?

Fear the dwemer pokeballs. Fear them!
IanM
Retired Moderator
22
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 24th Jul 2006 23:26
What 'repeat loops'?

For free Plug-ins and source code http://www.matrix1.demon.co.uk
Xarshi
18
Years of Service
User Offline
Joined: 25th Dec 2005
Location: Ohio
Posted: 24th Jul 2006 23:28 Edited at: 26th Jul 2006 07:45
like:


Fear the dwemer pokeballs. Fear them!
Xarshi
18
Years of Service
User Offline
Joined: 25th Dec 2005
Location: Ohio
Posted: 26th Jul 2006 07:45
What would the math functions pointer be? Would it be g_pGlob->g_Core,"?Atan2FFF@@YAKMM@Z"); basicly?

Fear the dwemer pokeballs. Fear them!
EddieB
20
Years of Service
User Offline
Joined: 29th Sep 2004
Location: United Kingdom
Posted: 26th Jul 2006 13:46 Edited at: 26th Jul 2006 13:46
You want that loop in C++?

IanM
Retired Moderator
22
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 26th Jul 2006 15:01
Actually, this would be closer:



The test is at the end, just like repeat uses.

Quote: "What would the math functions pointer be?"


Clarify your question ... what maths pointer? That happens to be the way to access the function to the atanfull command.

For free Plug-ins and source code http://www.matrix1.demon.co.uk
Xarshi
18
Years of Service
User Offline
Joined: 25th Dec 2005
Location: Ohio
Posted: 26th Jul 2006 20:55
I'm meaning like basic 3d is g_Basic3D and animation is g_Animation,but I don't know how to access the commands in the core dll. Like,(fBlah)GetProcAddress(g_pGlob->????,"blah")

I know blah isn't a function

Quote: "That happens to be the way to access the function to the atanfull command."

If you were saying thats how I do it,I don't think it is because I still get a crash when I do it.

Fear the dwemer pokeballs. Fear them!
IanM
Retired Moderator
22
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 26th Jul 2006 23:15
You need to use LoadLibrary to load DBProCore.dll and get a handle to it. Then you can use that handle with GetProcAddress to get the function pointer.

There are several of the DBPro DLLs that don't have handles within the globstruct for whatever reasons - when you need something from them, you just treat them like a standard DLL.

For free Plug-ins and source code http://www.matrix1.demon.co.uk
Xarshi
18
Years of Service
User Offline
Joined: 25th Dec 2005
Location: Ohio
Posted: 27th Jul 2006 01:01 Edited at: 27th Jul 2006 01:23
actually,I did the load library thing. Its good to know I did the right thing though

Edit: haha,nevermind,I apparently did that one wrong too. Oh well,I guess I don't need the core commands.

Fear the dwemer pokeballs. Fear them!
Varix
18
Years of Service
User Offline
Joined: 23rd May 2006
Location:
Posted: 30th Jul 2006 01:05
I read throught this, and it sounds really cool. How do u call a dll in devc++ though?
Xarshi
18
Years of Service
User Offline
Joined: 25th Dec 2005
Location: Ohio
Posted: 30th Jul 2006 03:55
I don't think its possible in dev c++. I tried getting my stuff to work. If it does,I'll upload a template that uses it

Fear the dwemer pokeballs. Fear them!
IanM
Retired Moderator
22
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 30th Jul 2006 05:06
Yes it is - been there, done it, and so have several others. The one that comes immediately to mind is Apexnow's plugin for loading Cart-shop scenes into DBPro.

LoadLibrary - Get the DLL name right.
GetProcAddress - Get the function name & type right.

For instance:
The correct library name is DBProCore.dll
The correct function type for the Atan2 function is DWORD (__cdecl *)(float,float)
The correct name is ?Atan2FFF@@YAKMM@Z

Xarshi
18
Years of Service
User Offline
Joined: 25th Dec 2005
Location: Ohio
Posted: 30th Jul 2006 18:36 Edited at: 30th Jul 2006 18:36
why is it dword? I do keep getting errors about that... or is that just the functions that return floats? That would explain why I get so many warnings.

Fear the dwemer pokeballs. Fear them!
IanM
Retired Moderator
22
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 30th Jul 2006 19:34
It's for exactly the same reason as you return DWORD's instead of float's - there is *no* difference between the plugins you write, and the plugins (such as core or basic3d) that you write.

This is how you deal with it:


or write a wrapper for the function that does this for you and hides the detail.

Xarshi
18
Years of Service
User Offline
Joined: 25th Dec 2005
Location: Ohio
Posted: 1st Aug 2006 01:49 Edited at: 1st Aug 2006 04:27
where is the start directory for LoadLibrary? Would I have to put in like: HMODULE dbpCore = LoadLibrary("Crogram FilesDark Basic SoftwareDark Basic ProfessionalCompilerpluginsDBProCore.dll");

Is that what I would have to do,or is the base directory where my plug-in would be,plugins user?

Edit: do you by chance have to include a command from the dll?

Fear the dwemer pokeballs. Fear them!
IanM
Retired Moderator
22
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 1st Aug 2006 10:33
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dllproc/base/loadlibrary.asp

or you can download and install a local copy of MSDN:

http://www.microsoft.com/downloads/details.aspx?FamilyID=373930cb-a3d7-4ea5-b421-dd6818dc7c41&DisplayLang=en

and in answer to your additrional question ... read my very first post in this thread!

Xarshi
18
Years of Service
User Offline
Joined: 25th Dec 2005
Location: Ohio
Posted: 2nd Aug 2006 08:14
Ok,thankyou for your help IanM I've been being a pest.lol. I know pretty much all I need to know now besides the rgb command. (it comes out dark green whenever I use it).

Woohoo. DP is finally released!
Xarshi
18
Years of Service
User Offline
Joined: 25th Dec 2005
Location: Ohio
Posted: 3rd Aug 2006 06:12
Ok,well,turns out I have a final question. It's this:
how do you make a function in c++ that is like the FreeObject() function?(people title it different,but most of us know what it is)

would it be like this?:


Woohoo. DP is finally released!
IanM
Retired Moderator
22
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 3rd Aug 2006 15:15
Very basically:



You'll need to link object_exist to the Basic3D version too.

Xarshi
18
Years of Service
User Offline
Joined: 25th Dec 2005
Location: Ohio
Posted: 4th Aug 2006 00:13
yeah I've linked it,I just didn't know how to do that one loop. Thanks a ton!

Woohoo. DP is finally released!
Xarshi
18
Years of Service
User Offline
Joined: 25th Dec 2005
Location: Ohio
Posted: 7th Aug 2006 18:40
Heh,wow,I keep on getting problems every day. Well,I'm not sure if this is possible,but is it possible to link the call dll function to your dll without making a new function for every single possiblity of variable parameters. Like,in the system resource,it will say something like "call dll%LSXXXX%". So how do I use this?

Woohoo. DP is finally released!
IanM
Retired Moderator
22
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 7th Aug 2006 20:30
Sure you can do that - just cast everything to a DWORD and pass it to the CALL DLL function ... but remember that every time you call that function it has to translate the DLL number to a DLL handle, and translate the function name to a function pointer, which although more convenient for you, will make the call a lot slower.

You'll also have to ensure that the DBProSystemDebug dll is linked into your project

Xarshi
18
Years of Service
User Offline
Joined: 25th Dec 2005
Location: Ohio
Posted: 7th Aug 2006 21:18
Thats more simple than I imagined it to be. For a second I thought I'd have to do every single combination there is for it

Woohoo. DP is finally released!

Login to post a reply

Server time is: 2024-11-22 12:09:51
Your offset time is: 2024-11-22 12:09:51