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 Globstruct.h to work in DevC++

Author
Message
Three Score
20
Years of Service
User Offline
Joined: 18th Jun 2004
Location: behind you
Posted: 12th Jun 2005 15:22 Edited at: 12th Jun 2005 17:28
Hello world
i am trying to get globstruct to work in dev c++ but is missing include files
is this part of the directx sdk and would the sdk work in devc++
and how would u go about configing dev to use directx

edit:
i got it working by installing directx sdk(april 2005) and adding the include dir to the include dirs in devc++ and the same with libs
still didnt work
so i tryed linking with every library in the lib file and it worked(and only gave 1 warnign about extra tokens in globstruct.h)

so i finally got this



or wait
no i read it wrong and thought the error was a warning
so i didnt have to include all those libs and now it works just fine without including them(although the lib dir is required to be set)


edit2:
It now compiles in dev but not in dbp
here is the code im using





and ignore anything that isnt in the stringtable(besides dbpstring)




What could possibly be wrong!!??

formerly shadows of emptiness
Paul Johnston
TGC Developer
22
Years of Service
User Offline
Joined: 16th Nov 2002
Location: United Kingdom
Posted: 12th Jun 2005 21:50 Edited at: 12th Jun 2005 22:15
I tried your code, but the string table wouldn't compile properly until I removed the includes at the beginning, this seemed to work:



make sure it's saved in a .rc file and that under Project>Project options>files the .rc file has 'include this file in the compilation' ticked.

dbpro should recognise the commands but at the moment they will crash because you need to receive the globstruct pointer from dbpro before you can use it to reference the 'CreateDeleteString' function.

In every dll that dbpro loads, it looks for the function '?ReceiveCoreDataPtr@@YAXPAX@Z' and if it finds it it sends the dll the globstruct pointer, this is what you need.

In visual c++ including this function in your code achieves this



when it is compiled and mangled it appears as dbpro expects and is found. when this function is compiled in dev-c++ it is mangled differently and dbpro can't find it. We can change this by using a .def file (a bit like a stringtable) to specify exactly how we want our functions to look.

Add a new resource file to your project and give it a .def extension. then add these lines to it:



('Project1' must be replaced by the name of your project)

plus any other functions that you want exported from your dll. In your case it would look like this:



Note: this file overwrites the __declspec(dllexport) and any functions not included in the .def will not be availabe to dbpro. __declspec is effectively ignored, so you can choose to leave it on your functions or remove it if you plan to continue with the .def file.

Including a funciton in the .def file without specifying how it should be exported (like the last two funcitons in the example) will be exported as they are (with the normal _Z8... format) or you can change the mangling yourself by using



the functions would then be exported as 'test1' and 'test2', however you still need a stringtable to make dbpro aware of them, and you must use the new function names in the stringtable, for example:



With the .def file the 'ReceiveCoreDataPtr' should be found by dbpro and called automatically at load time, you can then use the globstruct pointer to access all the functions of dbpro.

If you have any questions feel free to ask.
Three Score
20
Years of Service
User Offline
Joined: 18th Jun 2004
Location: behind you
Posted: 13th Jun 2005 02:19
wow
thank you thank you thank you!
This is exactly what i needed and it all makes since now(i was wondering how the dll got the pointer to globstruct without having to do anything)

one more thing
do u need to include receivecoredata in your stringtables also

formerly shadows of emptiness
Paul Johnston
TGC Developer
22
Years of Service
User Offline
Joined: 16th Nov 2002
Location: United Kingdom
Posted: 13th Jun 2005 02:31
Glad I could help.

You don't need to put it in the string table, that's only for commands you want to use in your own code.
Three Score
20
Years of Service
User Offline
Joined: 18th Jun 2004
Location: behind you
Posted: 13th Jun 2005 02:37 Edited at: 13th Jun 2005 02:38
ok i need some help
how do u compile the .def file
it is in my project but i have to override the build commands to compile it and should i also link it with the project

edit:
i mean the build command is automatically overiden the checkbox wont clear

formerly shadows of emptiness
Paul Johnston
TGC Developer
22
Years of Service
User Offline
Joined: 16th Nov 2002
Location: United Kingdom
Posted: 13th Jun 2005 02:57
opps, forgot about that bit.

don't worry about the overide build box, the def file shouldn't be included in compilation, the bit you need to change is under Project Options->paremters tab then in the 'linker' box add the line



or whatever your def file is called, to tell dev-cpp to use the new def file.
Eddie B
19
Years of Service
User Offline
Joined: 10th Apr 2005
Location:
Posted: 13th Jun 2005 02:57
Sparky, Do you check emails alot. I wanted to send you some questions.

DirectX in the learning
Paul Johnston
TGC Developer
22
Years of Service
User Offline
Joined: 16th Nov 2002
Location: United Kingdom
Posted: 13th Jun 2005 03:01
Sure, my e-mail address is sparky_152 (at) hotmail.com
Three Score
20
Years of Service
User Offline
Joined: 18th Jun 2004
Location: behind you
Posted: 13th Jun 2005 03:02
ok i have done that but it still crashes(test2)
so what is wrong with this thing

formerly shadows of emptiness
Paul Johnston
TGC Developer
22
Years of Service
User Offline
Joined: 16th Nov 2002
Location: United Kingdom
Posted: 13th Jun 2005 03:23
I can't remember exactly how you return strings to dbpro, but your code seems to work here. The most obvious thing I can think of is to make sure you removed the line



since that would overwrite the pointer you got from dbpro.

Failing that I'd start adding in some debugging output using msg boxes to see how far the code gets:



including those two lines in a function will produce a popup box whenever the function gets called.
Three Score
20
Years of Service
User Offline
Joined: 18th Jun 2004
Location: behind you
Posted: 13th Jun 2005 03:43
no it was the pointer override
now it works and reversestring gets hi and returns ih proudly

I HAVE RETURNED MY FIRST STRING IN DBP!!!!!

formerly shadows of emptiness
Darki
19
Years of Service
User Offline
Joined: 9th Jul 2005
Location: Switzerland
Posted: 9th Jul 2005 21:10
[size=16]HEUREKA[/size]

finally that helped me returning strings from my dll, built with dev-c++.

thanks.

Wer lesen kann ist klar im Vorteil
(this appears to be german)
darkdomy
21
Years of Service
User Offline
Joined: 6th Apr 2003
Location: Italy
Posted: 10th Aug 2005 07:12 Edited at: 10th Aug 2005 08:05
hello plese ...... , poste all project.....


not easy..... , help!!!

Dev c++ 4.9.9.0

download the globalstruc 5.8 ???

help plese post all project... or creating a tool

DO

PRINT bam1()

LOOP

close in dbpro not work!

creating a easy tool for build a dll for dbpro..... very important.. .

Anxiously awaiting BlueGUI v2

it informs to me when and ended BlueGUI v2

Attachments

Login to view attachments
Paul Johnston
TGC Developer
22
Years of Service
User Offline
Joined: 16th Nov 2002
Location: United Kingdom
Posted: 10th Aug 2005 17:49
@darkdomy - it's hard to make out exactly what you want, but the code you're using crashes DBpro because you need to remove the two lines that read:

darkdomy
21
Years of Service
User Offline
Joined: 6th Apr 2003
Location: Italy
Posted: 12th Aug 2005 09:24 Edited at: 12th Aug 2005 09:34
Tanks Very return

plese ( post the code sasmples the print command clone.... )

Very Tanks...

attend news


( wine and linux ... execute darkbasic program ?..... )

send a material linux in webmaster@discoveryweb.it

send a tutorial and others material for linux...

Anxiously awaiting BlueGUI v2

it informs to me when and ended BlueGUI v2
IanG
20
Years of Service
User Offline
Joined: 25th Sep 2004
Location: Cyberspace
Posted: 12th Aug 2005 12:31
wine the emulation program?

If so then no it can not run dbpro exe's


amd athlon xp 2600+,1280mb,FX 5200 128mb,200gb,xp pro sp2
Three Score
20
Years of Service
User Offline
Joined: 18th Jun 2004
Location: behind you
Posted: 25th Sep 2005 04:21
actually it could if you didnt use sprites or real things that require directx(print "hello world" ; wait key works)

n00bs will be shot on spot...
It only gets more logical from here(sigh)
IanG
20
Years of Service
User Offline
Joined: 25th Sep 2004
Location: Cyberspace
Posted: 25th Sep 2005 18:07
Quote: " actually it could if you didnt use sprites or real things that require directx(print "hello world" ; wait key works)"


have you tried that? because that does use directx routines


amd athlon xp 2600+,1280mb,FX 5200 128mb,200gb,xp pro sp2
DarkPhear
21
Years of Service
User Offline
Joined: 15th Oct 2003
Location: Brazil
Posted: 25th Sep 2005 19:04
Yes, it works if you only use text.

Download free games and demos at my page: http://darkphear.cjb.net
MultiJoy Plugin : use multiple joysticks / joypads in your program.http://darkphear.cjb.net

Login to post a reply

Server time is: 2024-11-21 20:08:58
Your offset time is: 2024-11-21 20:08:58