Xojo Conferences
XDCMay2019MiamiUSA

How to debug plugins on Windows (Real Studio Plugins Mailinglist archive)

Back to the thread list
Previous thread: I have found where this crash happens
Next thread: About new RB compiler, default params, enums


Re: Mail Errors [was Re: New Plugins SDK Available]   -   Jan Erik Moström <
  How to debug plugins on Windows   -   Kristiaan Coppieters
   Re: How to debug plugins on Windows   -   Paul Mitchum

How to debug plugins on Windows
Date: 17.01.03 21:13 (Sat, 18 Jan 2003 09:13:58 +1300)
From: Kristiaan Coppieters
Debugging REALbasic Plugins under Windows

Probably this is 'old hat' to many of you - but for those of you who are
like me struggling with REALbasic development of Windows apps, here is a
little trick I discovered to debug my plugins on a Windows computer.

(I am writing the stuff below from memory - I am not behind my Windows
machine to check, I am on my Mac - so it is possible I got some small
details wrong).

Ingredients I used:

CodeWarrior 8.3 for Mac
RB DLL Postlinker (from the Plugin SDK)
CodeWarrior 8.3 for Windows
REALbasic 4.5.2 for Mac OS X
Mac OS X 10.2.3
Windows 2000
Plugin project which creates a Windows plugin, or a fat (Carbon + Windows)
plugin

We run a CVS server on which we keep all our CodeWarrior projects in XML
format - so I can check the same CodeWarrior plugin project file out on
Windows and on Mac.

1) Compile your plugin project on the Mac; I have the RB DLL Postlinker
installed in appropriate the CodeWarrior plugins folder

2) Install the plugin into the REALbasic Plugins folder

3) Compile a .exe version of your project.

4) Copy the .exe version to the Win2000 machine

5) Run the .exe once (this just to allow it to extract the embedded .DLL
files from the .exe file)

6) Search for the location of the .DLL of your plugin - I found it in

C:\Documents And Settings\<my user name>\Application Data

(make sure you set your Explorer Folder Options to show invisible stuff -
select

Tools - Folder Options

in an Explorer window, then click 'View' and make sure it says 'Show Hidden
Files and Folders')

7) Open your plugin project under CodeWarrior for Windows. It will complain
about the missing RB DLL Postlinker.

Change the preferences of your project so it does not refer to the
postlinker any more (Target Settings) (it does not exist on Windows).

8) Change the project settings so it compiles the Windows version of the
plugin 'on top' of the extracted DLL - set the target settings so the output
directory is

C:\Documents And Settings\<my user name>\Application Data

Prepare all other project settings so the .DLL will be compiled for
debugging. Disable optimizations (Global optimizations), set debug format to
SYM (x86 Linker), Disable optimizations for debug (x86 Codegen).

Change the runtime settings of the .DLL project so it uses your compiled
REALbasic app as the host application (Runtime Settings).

I also added the following code to the plugin:

#if <compiling for Windows>
{
static int brk = 1;
if (brk)
{
brk = 0;
asm
{
int 3
}
}
#endif

This will make the plugin break into the debugger the first time it is run.

WARNING: Don't leave this code in when not debugging - you'll get an
unhandled exception when it hits the INT 3.

9) Compile the Windows plugin as a .DLL. It should appear in the

C:\Documents And Settings\<my user name>\Application Data

directory, overwriting the version extracted from the .exe file.

10) Switch to explorer, right-click the .DLL, bring up its properties, and
make it read-only.

Don't forget you did this: if you want to recompile, you'll have to remove
the read-only state, or you won't be able to recompile/relink.

Making it read-only is necessary to disable the extraction of the embedded
plugin DLL from the REALbasic app.

12) Run your .DLL from CodeWarrior - it will launch the REALbasic .exe file
which we set as the host app. The CodeWarrior debugger should come up in the
.DLL's source code when it hits the INT 3.

I hope this is useful to someone!

Best regards,

Kris

---
A searchable archive of this list is available at:
<http://support.realsoftware.com/KBDB/search.php>

Unsubscribe:
<mailto:<email address removed>>

Subscribe to the digest:
<mailto:<email address removed>>

Re: How to debug plugins on Windows
Date: 17.01.03 23:15 (Fri, 17 Jan 2003 16:15:11 -0600)
From: Paul Mitchum
On 1/17/03 2:13 PM, "Kristiaan Coppieters" <<email address removed>> wrote:

> 12) Run your .DLL from CodeWarrior - it will launch the REALbasic .exe file
> which we set as the host app. The CodeWarrior debugger should come up in the
> .DLL's source code when it hits the INT 3.
>
> I hope this is useful to someone!

It's useful to me... Thanks much!