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.

DarkBASIC Professional Discussion / DLLs in Borland C++

Author
Message
Kentaree
23
Years of Service
User Offline
Joined: 5th Oct 2002
Location: Clonmel, Ireland
Posted: 25th May 2003 23:03
Could anyone explain how to make DBPro compatible .DLLs with Borland Command Line Compiler 5.5? Most .DLL based info is aimed in particular at VC++ users, and I cant seem to get my dlls to work. I think it has something to do with the stringtable, but I have very little information on how to manually make an .rc file to compile as a resource and then link it with the dll. If someone could give me some info on this, or DLLs in general, I would be very thankfull.

Cheers,
Kentaree
Whatever I did I didn't do it!
IanM
Retired Moderator
23
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 25th May 2003 23:47
I believe that the free compiler comes with the same resource editor as delphi. If that is true, then the way that I posted here should work : http://www.darkbasicpro.com/apollo/view.php?t=10646&b=5

Can you try, and then repost your results here? If it doesn't work, then I'll work something out for you.
Kentaree
23
Years of Service
User Offline
Joined: 5th Oct 2002
Location: Clonmel, Ireland
Posted: 26th May 2003 00:27
Ok, looking it up now, thanx

Whatever I did I didn't do it!
Kentaree
23
Years of Service
User Offline
Joined: 5th Oct 2002
Location: Clonmel, Ireland
Posted: 26th May 2003 17:56
Okay, the Delphi code is very like the c++, the main differences being that there's no comma between the number and the string, and its loaded into the dll by putting this code at the top of your .cpp dll source file: pragma resource "file.res". I'm now getting some response from DBPro when I try to use my command, but not one I'd like: "Could not find function 'MyTest' in 0:core.dll". Usually I'd get no response at all, so this is an improvement .

The source for my test .dll is:



And the code for my .rc file is:



Could this be because I need the "decorated function name", because when I load the .dll into notepad, I cant seem to find anything like the ones in the documentation.

Whatever I did I didn't do it!
IanM
Retired Moderator
23
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 27th May 2003 01:56
This should be simple to fix.

Just change the define line to this:

#define MYCOMMAND extern "C" __declspec( dllexport )

That should then allow you to use the undecorated names in your string resource
Kentaree
23
Years of Service
User Offline
Joined: 5th Oct 2002
Location: Clonmel, Ireland
Posted: 27th May 2003 22:08
Thanks, but unfortunately it didnt work. I still get the same error, and I tried to use load dll and checked using dll call exist, and couldnt find it there either, so now I'm kinda stumped. Does anyone maybe have a sample .dll (non VC++, as the resource files wont compile with BCC) that I can try out?

Whatever I did I didn't do it!
Shadow Robert
23
Years of Service
User Offline
Joined: 22nd Sep 2002
Location: Hertfordshire, England
Posted: 28th May 2003 01:27
file.cpp


file.h


add main headers within the .cpp and headers used from the main header int the .h using " " not < >

you'll also want a .def file



i don't know the compile extension for it, but you use a .def in C instead for a resource table it should work identically ... i thinka few borland users on thier forums could explain how

Within the Epic battle of the fates the Shadow and the Angel will meet. With it will harbinger the very fight of good vs evil!
Kentaree
23
Years of Service
User Offline
Joined: 5th Oct 2002
Location: Clonmel, Ireland
Posted: 28th May 2003 03:29
Nope, I try to compile it as an .obj file so I can link the .def file with it, but it complains that at line 4: Declaration terminated incorrectly. :-s I'm getting really confused now. Prolly has something to do with my inexperience in C and C++...

Whatever I did I didn't do it!
Kentaree
23
Years of Service
User Offline
Joined: 5th Oct 2002
Location: Clonmel, Ireland
Posted: 29th May 2003 00:07
To save myself from more hassle, I'm gonna ask this first: Has anybody actually gotten a .dll made with BCC 5.5 working in DBPro?

Whatever I did I didn't do it!

Login to post a reply

Server time is: 2026-07-11 11:42:41
Your offset time is: 2026-07-11 11:42:41