April 20, 2024, 08:01:07 AM

News:

IonicWind Snippit Manager 2.xx Released!  Install it on a memory stick and take it with you!  With or without IWBasic!


Making a DLL

Started by kryton9, September 11, 2006, 02:29:36 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

kryton9

I need to follow these instructions for making a DLL and wonder how I can do this in Aurora, any help appreciated. thanks in advance.
1. Creating your DLL Functions

1.1. Open Visual C++ 6.0 and select NEW, choose Win32 Dynamic-Link Library, call your project TESTCOMMANDS and click OK
1.2. Select 'Create a SIMPLE DLL Project'.
1.3. Click FILE VIEW, double click TESTCOMMANDS files, then Source Files, then TESTCOMMANDS.CPP
1.4. When you double click on TESTCOMMANDS.CPP, you will see the DLLMAIN function common to most DLLs
1.5. Create your first two functions by typing out:

#define MYCOMMAND __declspec ( dllexport )
MYCOMMAND void PrintText( LPSTR pString )
{
if(pString)
{
ÂÃ,  MessageBox(NULL, pString, "", MB_OK);
}
}
MYCOMMAND int GetValue( void )
{
return 42;

2. Creating your DLL String Table

2.1. Your string table will let DBPro know what commands your DLL has and what functions each command uses. It also tells DBPro what parameters to
expect and optionally what those parameters actually mean.

2.2. Click INSERT from the Menu, then RESOURCE..

2.3. Select STRING TABLE to highlight it and then click NEW to create a new string table

2.4. Double click the highlighted box under ID and then click in the caption box where we will type out our first command:

PRINT TEXT%S%?PrintText@@YAXPAD@Z%String
Now we will add our second command. The main difference is that this will be an expression in DBPro. A command that returns a value is called an
expression, and can be denoted by adding a [ bracket after the command, as follows:

GET VALUE[%L%?GetValue@@YAHXZ
Now select the PROJECT menu and click ADD TO PROJECT and then FILES. Select TESTCOMMANDS.RC and click OK. To make sure, click F7 to
compile your DLL. It will now contain a string table describing your first command.

All DLLs written in languages other than C++ should use the cdecl calling convention.

Zen

Hi cryton. Creating DLL's in Aurora is quite simple.

here is a simple function in a standard Win32 DLL in Aurora...


/*** The Export Keyword Tells The Linker ***/
/*** That The Specified Subroutines Are  ***/
/***   To Be Made Visible So To Speak    ***/
/*******************************************/

export myFirstFunction;
export myCalcFunction;

/*************************************/
/*** Simple Hello World Subroutine ***/
/*************************************/

sub myFirstFunction(),string {

return "Hello World!";

}

/***************************************/
/*** Simple Math Addition Subroutine ***/
/***************************************/

sub myCalcFunction(float val1, float val2),float {

return val1 + val2;

}


Hope this helps.

Lewis

Zen

Sorry, forgot to mention, just incase... Obviously you would compile this as a DLL target.

Lewis

kryton9

Thanks Zen, will test it out.

Where would I put the strings they are talking about as a resource?

Zen

At the moment there is no editor in the IDE to create string resource. There is a section in the GORC (Resource Compiler) manual regarding string tables. So at the moment you would have to enter them manually.

Dont quote me but i believe the format is this...


STRINGTABLE
BEGIN
101,"Hello World"
102,"Goodbye World"
END


I think i remember Paul telling me a few years ago to use ID's above 100 as it sometimes causes problems with some operating systems.

At the moment, you would also need to use the windows API to load the string resources into your application. Unless Paul has added support for loading strings into the core.

Lewis

kryton9

Thanks Zen, I couldn't get it to work, it is not critical, just wanted to see if I could use it at this time.