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 / Good practice for functions returning a value?

Author
Message
Matty H
11
Years of Service
User Offline
Joined: 7th Oct 2008
Location: England
Posted: 7th Oct 2010 22:00
Hi, I'm creating my first dll for DBPro.
I dont really know the language(DBPro) as I have never used it so I will learn what I need as I go.
It seems to me that you can't call a funtion that returns a value without assigning the value to a variable, is this correct?



If this is the case I have a 'good practice' issue.
Should I force the user to place the value in a variable even if it may not be needed? Or, should I only return values if they are necessary for the use of the function?

The second means I can't return 0 for example if something failed inside the function(dll), although I could provide another function to give that information if required, so which is best?

Thanks.

IanM
Retired Moderator
17
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 8th Oct 2010 01:16
Create two versions in your resource string - one that operates as a function, and one that operates as a command.

A simple example that I have is my APPEND LIMB function/command combination.

Here are the resource strings used for that command.


One thing to note is that each function and its equivalent command use the same C++ function - even though the C++ function returns a value, when called as a command, DBPro will just ignore it.

Utility plug-ins (26-JUL-2010)
I'm applying terms of use that require you to wear a red nose and honk a horn whenever you use the Internet
Matty H
11
Years of Service
User Offline
Joined: 7th Oct 2008
Location: England
Posted: 8th Oct 2010 02:05
Ah, this is perfect thanks, I'm glad I asked now as neither of the solutions I mentioned were ideal.

Thanks again.

Login to post a reply

Server time is: 2019-10-15 10:45:20
Your offset time is: 2019-10-15 10:45:20