Developer forums (C::B DEVELOPMENT STRICTLY!) > Plugins development

ThreadSearch plugin is born !

<< < (6/12) > >>

Pecan:
Here's what I came up with to get it to compile under Linux.



--- Code: ---diff -u C:\Usr\Proj\ThreadSearch/ThreadSearch.cpp e:\linux\proj\ThreadSearch/ThreadSearch.cpp
--- C:\Usr\Proj\ThreadSearch/ThreadSearch.cpp 2007-02-20 22:54:02.000000000 -0500
+++ e:\linux\proj\ThreadSearch/ThreadSearch.cpp 2007-03-14 13:04:36.000000000 -0500
@@ -17,6 +17,11 @@
 #include "ThreadSearchConfPanel.h"
 #include "ThreadSearchControlIds.h"

+//Missing headers //(pecan 2007/3/14)
+#include "messagemanager.h"
+#include "configmanager.h"
+#include "sdk_events.h"
+
 class wxFlatNotebook;

 // Register the plugin with Code::Blocks.
Files C:\Usr\Proj\ThreadSearch/ThreadSearch.zip and e:\linux\proj\ThreadSearch/ThreadSearch.zip differ
diff -u C:\Usr\Proj\ThreadSearch/ThreadSearchEvent.h e:\linux\proj\ThreadSearch/ThreadSearchEvent.h
--- C:\Usr\Proj\ThreadSearch/ThreadSearchEvent.h 2007-03-11 10:17:34.000000000 -0500
+++ e:\linux\proj\ThreadSearch/ThreadSearchEvent.h 2007-03-14 12:49:58.000000000 -0500
@@ -19,6 +19,26 @@
 #include <wx/event.h>
 #include <wx/arrstr.h>

+//(pecan 2007/3/14)
+#if defined(__WXGTK__)
+    #ifdef _MSC_VER
+      #ifdef BUILDING_DLL
+        #define DLLEXPORT __declspec(dllexport)
+      #else
+        #define DLLEXPORT __declspec(dllimport)
+      #endif
+      #define DLLLOCAL
+    #else
+      #ifdef HAVE_GCCVISIBILITYPATCH
+        #define DLLEXPORT __attribute__ ((visibility("default")))
+        #define DLLLOCAL __attribute__ ((visibility("hidden")))
+      #else
+        #define DLLEXPORT
+        #define DLLLOCAL
+      #endif
+    #endif
+#endif
+
 class ThreadSearchEvent : public wxCommandEvent
 {
 public:
@@ -45,7 +65,9 @@
 typedef void (wxEvtHandler::*ThreadSearchEventFunction)(ThreadSearchEvent&);

 BEGIN_DECLARE_EVENT_TYPES()
- DECLARE_EXPORTED_EVENT_TYPE(__declspec(dllexport), wxEVT_THREAD_SEARCH, wxID_ANY)
+    //(pecan 2007/3/14)
+ //DECLARE_EXPORTED_EVENT_TYPE(__declspec(dllexport), wxEVT_THREAD_SEARCH, wxID_ANY)
+ DECLARE_EXPORTED_EVENT_TYPE(DLLEXPORT, wxEVT_THREAD_SEARCH, wxID_ANY)
 END_DECLARE_EVENT_TYPES()

 #define EVT_THREAD_SEARCH(id, fn) \

--- End code ---

However, it must not be right, because the layout gets screwed up when I resize CB. Sometimes the menu completely disappears. I think it's not getting its events.

When I enter a search string into the search textCtrl, it doesn't do anything.

dje:
Pecan,
I found the magical macro in wxWidgets dlimpexp.h :
WXEXPORT
All OSs are managed.

Why do you speak of missing includes, on LINUX:
sdk.h -> sdk_precomp.h -> sdk_common.h -> configmanager.h, messagemanager.h and sdk_events.h

To have this behaviour, the CB_PRECOMP macro must be defined in project settings and __WXMSW__ must not be defined.
Can you check and tell me more about this ?

ThreadSearch 0.4 is available :

* plugin
* source code
What's new :

*
--- Quote ---I'll add another menu entry in the Search menu with the same event ID as in the view menu.
--- End quote ---

* Use of the WXEXPORT instead of __declspec(dllexport) to compile under LINUX (correction has to be checked)
Dje

killerbot:
not all compilers support precompiled headers, and the CB_PRECOMP is for pch's.
To be honest, I hate them. Today I once again fixed a bug due to those darn pch's.
Pch's can be a help , a speed up, but still people first need to write correct headers and includes, and only then pch should be applied. Now too many people write incorrect headers and includes but things work because of those pch's (this is not a good side effect, it is a bad one, because it create unportable code). I once prepared a post on correct header inclusion, next week I will spend a lot of time in hotels. I will finish it and post it (finally), it will explain al ot of things.

Basically you do something like this :

#include "sdk.h"
#indef CB_PRECOMP
 // include here all headers which are actually needed and are otherwise delivered through include of sdk.h
#endif
// include here all remaining headers needed and which are not provided by sdk.h

when there's no CB_PRECOMP then sdk.h should bring no headers at all, that's the correct way.

I promise to post my article next week to clarify a lot of things.


Cheers,
Lieven

dje:
I'll apply this in O.5, but not today, it's time to stop !

MortenMacFly:

--- Quote from: dje on March 14, 2007, 10:49:17 pm ---What's new :

*
--- Quote ---I'll add another menu entry in the Search menu with the same event ID as in the view menu.
--- End quote ---

* Use of the WXEXPORT instead of __declspec(dllexport) to compile under LINUX (correction has to be checked)
--- End quote ---
Nice one. Will try tomorrow. So far I have attached something you might want to consider, too: The zip file contains fixes to the project file (there were e.g. references to non-existing folders) and an update to the post-build process using a batch file on windows. Thus ensuring that the images are being copied to all locations required.
The same file can be converted to a unix bash script appropriate next to another project file for unix.

With regards, Morten.

[attachment deleted by admin]

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version