1. Creating DLL's

Well, I figured out how to create a DLL (and pass arbitrary sequences!)
using Eu/Eu2C (I've been using the PD version).  To pass sequences, I used a
modified version of the (de)compress routines in database.e.  I'm sending
the code to Rob, but here are the basics for creating a DLL:

1) Change the entry point by creating a function, DLLMain. DLLMain can be a
blank function that returns 1.

BOOL WINAPI DLLMain(HINSTANCE hDLL,DWORD Reason,LPVOID Reserved)
{

    return 1;
};

2) Modify WinMain as follows:
Change the declaration:
void __declspec(dllexport) Main_(void *hInstance)

Comment out any references to argc or argv.  These refer to command line
arguments, and shouldn't be used by the DLL.  If your code uses command line
arguments, you'll probably want to create some functions to be called to
replace the command line args.  You'll also need to comment out Cleanup(0)
at the end of WinMain, to allow the DLL to continue.

3) Export functions.  You'll need to add __declspec(dllexport) to the
declarations of any functions you want to be called from outside the DLL.
When you import the function to Eu, you'll need to add a '_' to the
beginning:

If you have:
int __declspec(dllexport) foo()

Then in your Eu program:
bar = define_c_func( dllname, "_foo", {}, C_INT)

4) Change the makefile to compile a DLL.  I've only done this with Borland.
You'll need to check the manual of your compiler to see how to compile a
DLL.  The second line of emake.bat will begin:

@bcc32 -tW ....

Change this to:
@bcc32 -tWD ...

and Borland will compile your code into a DLL.
  
5) You may need to make/remove dummy function calls to keep the translator
from optimizing routines away.  Just comment these out as appropriate.

Matt Lewis

new topic     » topic index » view message » categorize

2. Re: Creating DLL's

On 27 Feb 2001, at 10:02, matthewwalkerlewis at YAHOO.COM wrote:

> 
> Well, I figured out how to create a DLL (and pass arbitrary sequences!)
> using Eu/Eu2C (I've been using the PD version).  To pass sequences, I used a
> modified version of the (de)compress routines in database.e.  I'm sending
> the code to Rob, but here are the basics for creating a DLL:
> 
> 1) Change the entry point by creating a function, DLLMain. DLLMain can be a
> blank function that returns 1.
> 
> BOOL WINAPI DLLMain(HINSTANCE hDLL,DWORD Reason,LPVOID Reserved)
> {
> 
>     return 1;
> };
> 
> 2) Modify WinMain as follows:
> Change the declaration:
> void __declspec(dllexport) Main_(void *hInstance)
> 
> Comment out any references to argc or argv.  These refer to command line
> arguments, and shouldn't be used by the DLL.  If your code uses command line
> arguments, you'll probably want to create some functions to be called to
> replace the command line args.  You'll also need to comment out Cleanup(0)
> at the end of WinMain, to allow the DLL to continue.
> 
> 3) Export functions.  You'll need to add __declspec(dllexport) to the
> declarations of any functions you want to be called from outside the DLL.
> When you import the function to Eu, you'll need to add a '_' to the
> beginning:
> 
> If you have:
> int __declspec(dllexport) foo()
> 
> Then in your Eu program:
> bar = define_c_func( dllname, "_foo", {}, C_INT)
> 
> 4) Change the makefile to compile a DLL.  I've only done this with Borland.
> You'll need to check the manual of your compiler to see how to compile a
> DLL.  The second line of emake.bat will begin:
> 
> @bcc32 -tW ....
> 
> Change this to:
> @bcc32 -tWD ...
> 
> and Borland will compile your code into a DLL.
> 
> 5) You may need to make/remove dummy function calls to keep the translator
> from optimizing routines away.  Just comment these out as appropriate.

How i long for the days when i could click on the Compile button (i think it was
F9 too)
in the Turbo Pascal IDE and get a stand-alone exe that ran perfectly fine. All
those
parameters and macros were stored, and could be reconfigured with a popup check 
box.

Speaking of retro code and OSs, how compatable will the Eu dos gui be to
win3.11?
The pascal ide turned out a copycat gui of win3.x, altho i still think it was MS
that
stole that look and feel from Borland.

Kat

new topic     » goto parent     » topic index » view message » categorize

3. Re: Creating DLL's

--- matthewwalkerlewis at YAHOO.COM wrote:
> 
> Well, I figured out how to create a DLL (and pass
> arbitrary sequences!)
> using Eu/Eu2C (I've been using the PD version).  To
> pass sequences, I used a
> modified version of the (de)compress routines in
> database.e.  I'm sending
> the code to Rob, but here are the basics for
> creating a DLL:
> 
> 1) Change the entry point by creating a function,
> DLLMain. DLLMain can be a
> blank function that returns 1.
> 
> BOOL WINAPI DLLMain(HINSTANCE hDLL,DWORD
> Reason,LPVOID Reserved)
> {
> 
>     return 1;
> };
> 
> 2) Modify WinMain as follows:
> Change the declaration:
> void __declspec(dllexport) Main_(void *hInstance)
> 
> Comment out any references to argc or argv.  These
> refer to command line
> arguments, and shouldn't be used by the DLL.  If
> your code uses command line
> arguments, you'll probably want to create some
> functions to be called to
> replace the command line args.  You'll also need to
> comment out Cleanup(0)
> at the end of WinMain, to allow the DLL to continue.
> 
> 3) Export functions.  You'll need to add
> __declspec(dllexport) to the
> declarations of any functions you want to be called
> from outside the DLL.
> When you import the function to Eu, you'll need to
> add a '_' to the
> beginning:
> 
> If you have:
> int __declspec(dllexport) foo()
> 
> Then in your Eu program:
> bar = define_c_func( dllname, "_foo", {}, C_INT)
> 
> 4) Change the makefile to compile a DLL.  I've only
> done this with Borland.
> You'll need to check the manual of your compiler to
> see how to compile a
> DLL.  The second line of emake.bat will begin:
> 
> @bcc32 -tW ....
> 
> Change this to:
> @bcc32 -tWD ...
> 
> and Borland will compile your code into a DLL.
>   
> 5) You may need to make/remove dummy function calls
> to keep the translator
> from optimizing routines away.  Just comment these
> out as appropriate.
> 
> Matt Lewis 
> 
> 
>
> http://www.topica.com/partner/tag01
>

new topic     » goto parent     » topic index » view message » categorize

4. Re: Creating DLL's

Thanks man, but I allready did this for Rob a while
back.
The feature is gonna be in there soon, but you'll have
to be patient.

BTW, DLLMain is wrong, it should be LIBMain; DLLMain
is only in VC++, LibMain is the standard.

Mike The Spike

--- matthewwalkerlewis at YAHOO.COM wrote:
> 
> Well, I figured out how to create a DLL (and pass
> arbitrary sequences!)
> using Eu/Eu2C (I've been using the PD version).  To
> pass sequences, I used a
> modified version of the (de)compress routines in
> database.e.  I'm sending
> the code to Rob, but here are the basics for
> creating a DLL:
> 
> 1) Change the entry point by creating a function,
> DLLMain. DLLMain can be a
> blank function that returns 1.
> 
> BOOL WINAPI DLLMain(HINSTANCE hDLL,DWORD
> Reason,LPVOID Reserved)
> {
> 
>     return 1;
> };
> 
> 2) Modify WinMain as follows:
> Change the declaration:
> void __declspec(dllexport) Main_(void *hInstance)
> 
> Comment out any references to argc or argv.  These
> refer to command line
> arguments, and shouldn't be used by the DLL.  If
> your code uses command line
> arguments, you'll probably want to create some
> functions to be called to
> replace the command line args.  You'll also need to
> comment out Cleanup(0)
> at the end of WinMain, to allow the DLL to continue.
> 
> 3) Export functions.  You'll need to add
> __declspec(dllexport) to the
> declarations of any functions you want to be called
> from outside the DLL.
> When you import the function to Eu, you'll need to
> add a '_' to the
> beginning:
> 
> If you have:
> int __declspec(dllexport) foo()
> 
> Then in your Eu program:
> bar = define_c_func( dllname, "_foo", {}, C_INT)
> 
> 4) Change the makefile to compile a DLL.  I've only
> done this with Borland.
> You'll need to check the manual of your compiler to
> see how to compile a
> DLL.  The second line of emake.bat will begin:
> 
> @bcc32 -tW ....
> 
> Change this to:
> @bcc32 -tWD ...
> 
> and Borland will compile your code into a DLL.
>   
> 5) You may need to make/remove dummy function calls
> to keep the translator
> from optimizing routines away.  Just comment these
> out as appropriate.
> 
> Matt Lewis 
> 
> 
>
> http://www.topica.com/partner/tag01
>

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu