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 / DLL: Transporting

Author
Message
n3t3r453r
23
Years of Service
User Offline
Joined: 8th Nov 2002
Location: Russia
Posted: 6th Jan 2003 17:43
I'm writing some plugins to DBpro, that lets u to use standart MS-windows GUI(Graphic User Interface) on MSVC++ 6.0. All was well before i tryed to include my DLL to DB plugins-user catalog. Strange , my DLL works well, i'm sure but it doesn't want to work in DBpro!!!!!

I think problem isn't in changing function name.
(there is some bug in MS-C compiler that change function name for example myFuncTest(int a, int b) to _myFuncTest@8)
That is a part of code that must fix this bug:
/**/
#define DLLTESTLIB extern "C" __declspec(dllexport)
And this strings in .DEF file:
EXPORTS
myFuncTest

I won't explain how it must work (bad english ) but if you want to know i advise you to read Jeffry Richter's book "Windows for professionals".

I read Lee's article about writing DLLs but i don't know even what is "plain english"? Also I think that it isn't needed if u use such cunning with changing function name, am i right?

Can anybody help me? Also i'd like to know on what compiler DBpro has been compiled?
MrTAToad
23
Years of Service
User Offline
Joined: 26th Aug 2002
Location: United Kingdom
Posted: 6th Jan 2003 17:47
Name-mangling isn't a bug - its needed for C++.

Whats the problem with the DLL ? Does DBPro say it can't find the correct function ? If so, make sure that the function has been exported and that you've set up the string table correctly. Remove the definition from the .DEF file.

It helps if you've got the Depends program, but if not, you've just got to keep loading up notepad...

I'm pretty sure DBPro was done using VC6.

Good news everyone! I really am THAT good...
http://www.nickk.nildram.co.uk/ for great plug-ins - oh my, yes!
MrTAToad
23
Years of Service
User Offline
Joined: 26th Aug 2002
Location: United Kingdom
Posted: 6th Jan 2003 17:49
If you still cant do it, e-mail me ALL the files, and I'll take a look.

Good news everyone! I really am THAT good...
http://www.nickk.nildram.co.uk/ for great plug-ins - oh my, yes!
IanM
Retired Moderator
23
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 6th Jan 2003 19:53
As an alternative, I put together a DLL framework for one of the guys on DBDN with lot of comments.

If you want to download it to see one way of doing things you're quite welcome.

http://www.matrix1.demon.co.uk/DBPro/Framework01.zip
n3t3r453r
23
Years of Service
User Offline
Joined: 8th Nov 2002
Location: Russia
Posted: 7th Jan 2003 09:13
@MrTAToad: OK. Imagine that i'll remove "extern 'C'" and EXPORTS in DEF file and set up the table as in Lee's article then function name will be translated to myFunc@@JHKFAJHDSAFLN And i simply don't know what is "@@JHKFAJHDSAFLN" and where i can find it?

@IanM: thanks. i've just donwloaded it. I'll see. Thanks ones more.
levent
23
Years of Service
User Offline
Joined: 2nd Nov 2002
Location: United States
Posted: 7th Jan 2003 09:42
Net Eraser: Open your dll with Notepad. Find your function name. Next to it you'll see the @@xxxxxxxx entry.

-levent
n3t3r453r
23
Years of Service
User Offline
Joined: 8th Nov 2002
Location: Russia
Posted: 7th Jan 2003 16:01
@Levent:
Ok. But imagine that my dll is for example 3 exabyte (max file size that windows supports) and how long Notepad will open it (and will it be opened at all?). What's why such method isn't very good
MrTAToad
23
Years of Service
User Offline
Joined: 26th Aug 2002
Location: United Kingdom
Posted: 7th Jan 2003 17:36
You'll to get a dependancy walker from somewhere...

Good news everyone! I really am THAT good...
http://www.nickk.nildram.co.uk/ for great plug-ins - oh my, yes!
GuySavoie
23
Years of Service
User Offline
Joined: 26th Aug 2002
Location:
Posted: 7th Jan 2003 18:49
>But imagine that my dll is for example 3 exabyte
>(max file size that windows supports) and how long
>Notepad will open it (and will it be opened at all?).
>What's why such method isn't very good

That's not a valid argument until your computer has 3 exabytes of RAM to load that DLL..

As a proper alternative, download a PE viewer/explorer program. You can then find all of the decorated names of exported routines.

I prefer PEView 0.70 at http://www.magma.ca/~wjr

IanM
Retired Moderator
23
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 7th Jan 2003 20:46
I've started writing my own.

I got sick of converting those mangled names back to function prototypes, so mine can to that for me (only for C++ though).
n3t3r453r
23
Years of Service
User Offline
Joined: 8th Nov 2002
Location: Russia
Posted: 8th Jan 2003 09:03
@GuySavoie:
No that's a good argument to use undecorated names. And my comp. needn't 3eb of RAM (Do you know about loading files as "two file - one buffer" or "one file - no buffer"?)

@IanM:
I've downloaded you DLL. It doesn't works . DBpro says that "Function in DLLs export table 'GET VALUE[%L%returnValue'" unrecognized, or something in same manner.
P.S.> I use DBpro demo (still there is no full rus version)
IanM
Retired Moderator
23
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 8th Jan 2003 15:08
Guy is right - A DLL has to be able to fit into memory for you to be able to use it, as Windows may need to relocate it in memory.

Decorated names are good - they allow you to easily reconstruct the prototypes for the exported functions - I wouldn't be able to call DBPro internal routines without them

The framework will absolutely not work with any version of DBPro prior to patch 3 I'm afraid. It relies on functionality that was introduced at that point.
JamDotNET
23
Years of Service
User Offline
Joined: 15th Jan 2003
Location: United States
Posted: 15th Jan 2003 16:03
When I first installed and ran the dbp trial, the first impression I got, as far as what it was created/compiled in, was C# (the .NET version of C)

Anyone out there know for sure?

Jam
MrTAToad
23
Years of Service
User Offline
Joined: 26th Aug 2002
Location: United Kingdom
Posted: 15th Jan 2003 16:31
Its Visual C V6 (hopefully with SP5).

It can be a bit annoying, as that version has all pointers as 32-bits and Visual C .Net has them as 64-bits...

So, if your using .Net (and I presume C#), you get some nice jolly warnings...

Thats why I do my DLL's in C .NET and the plug-ins in VS6

Good news everyone! I really am THAT good...
http://www.nickk.nildram.co.uk/ for great plug-ins - oh my, yes!
IanM
Retired Moderator
23
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 15th Jan 2003 18:09
You can switch that off fairly easily.

In the 'Solution explorer' window, right click on your project and select properties.
In the resulting window, click on C/C++ in the configuration properties. In the frame on the right, you will see a box containing 'Detect 64-bit Portability Issues' - set it to No and click OK.

Easier to do than describe
MrTAToad
23
Years of Service
User Offline
Joined: 26th Aug 2002
Location: United Kingdom
Posted: 15th Jan 2003 18:28
I know - dont really want to though...

Good news everyone! I really am THAT good...
http://www.nickk.nildram.co.uk/ for great plug-ins - oh my, yes!

Login to post a reply

Server time is: 2026-06-11 12:41:32
Your offset time is: 2026-06-11 12:41:32