Re: AbiCollab Win32 GUI - so close, need some answers

From: Dominic Lachowicz <>
Date: Tue Jul 17 2007 - 20:57:49 CEST

This is just pure speculation.

DllMain needs extern "C" linkage. ABI_PLUGIN_DECLARE() doesn't use
that, so the name gets mangled and the "DllMain" in libmingw.a gets
invoked instead.

Apply the following diff to xap_Module.h and give it a try:

Index: xap_Module.h
--- xap_Module.h (revision 21596)
+++ xap_Module.h (working copy)
@@ -44,7 +44,7 @@
 #ifdef WIN32
   #define WIN32_LEAN_AND_MEAN
   #include <windows.h>
- #define ABI_PLUGIN_DECLARE(name) static HANDLE s_hModule =
static_cast<HANDLE>(NULL); BOOL APIENTRY DllMain( HANDLE hModule,
DWORD ul_reason_for_call, LPVOID lpReserved ) { s_hModule = hModule;
return TRUE; }
+ #define ABI_PLUGIN_DECLARE(name) static HANDLE s_hModule =
static_cast<HANDLE>(NULL); extern "C" { BOOL APIENTRY DllMain( HANDLE
hModule, DWORD ul_reason_for_call, LPVOID lpReserved ) { s_hModule =
hModule; return TRUE; } }
   #define ABI_PLUGIN_DECLARE(name)

On 7/17/07, Ryan Pavlik <> wrote:
> Hey all! As those of you subscribed to the commit list know, I've been
> making some large changes to the Win32 port of AbiCollab in an attempt
> to get it to have a GUI. I am very close now, and could use some
> pointers (no pun intended) with regard to a few specific questions.
> I am calling the Win32 function DialogBoxParam() in order to create a
> dialog. One of the parameters is an HINSTANCE of the image (exe/dll)
> that contains the resource. Setting this up in the most obvious manner
> gets the HINSTANCE from XAP_App, which seems incorrect: that is the
> handle to the AbiWord.exe image, not the AbiCollab.dll image where the
> dialog actually is stored. The error I am getting (1814) when running
> the dialog seems to confirm this suspicion.
> Browsing around Aiksaurus and Google Code Search of Abi, it seems as
> though ABI_PLUGIN_DECLARE gets expanded on Windows to create a DllMain
> function [1], which gets an HMODULE from Windows and which can be used
> interchangably with HINSTANCEs. The commit log [2] seems to confirm my
> thought that I need to get to the s_hModule in the plugin and use that
> when creating the dialog.
> I have added code to the AbiCollab plugin to store this value. In the
> best way that seems to be possible, it is being stored in the Session
> Manager, with the same methods used in the XAP_App. So, I think I have
> that part right.
> Here's my question. The code in AbiCollab_Plugin.cpp is telling me that
> the HMODULE it's getting (s_hModule) is 0, and this 0 is getting
> successfully passed along to the dialog code, where it does nothing to
> help display a dialog. Is there something I'm missing in
> AbiCollab_Plugin to extract the correct value? Could someone with more
> experience review my latest commit (mainly the AbiCollab_Plugin part and
> the ap_Win32Dialog_CollaborationAccounts part) and see if I've made any
> glaring errors and/or oversights?
> Thanks to sum1 for helping me debug this code tonight and serving as a
> highly accurate neural grep :)
> Ryan
> [1]
> [2]
> (from Dom)
> --
> Ryan Pavlik
> AbiWord Win32 Platform Maintainer, Art Lead:
> AbiWord Community Outreach Project:
> "Optimism is the father that leads to achievement."
> -- Helen Keller
> "The folder structure in a modern Linux distribution such as Ubuntu
> was largely inspired by the original UNIX foundations that were
> created by men with large beards and sensible jumpers."
> -- Jono Bacon, The Ubuntu Guide

Counting bodies like sheep to the rhythm of the war drums.
Received on Tue Jul 17 20:56:04 2007

This archive was generated by hypermail 2.1.8 : Tue Jul 17 2007 - 20:56:04 CEST