gtk_init outside main
- From: Moser Markus <moses landshut org>
- To: gtk-list gnome org
- Subject: gtk_init outside main
- Date: Wed, 29 May 2002 10:41:12 +0200
Hi!
I am writing plugins for a proprietary CAD-program (Pro/Engineer).
The target platforms currently are HP UX, SGI IRIX, IBM AIX and Windows NT.
Existing code (not from me) is written in C using TCL scripts for GUIs that
cannot be generated with the API of the CAD-program, which only provides
menus and simple text input/output for user interaction.
Communication with the TCL-scripts is done with temporary files (sigh).
As I want to get rid of this TCL-stuff, I decided to use GTK as a replacement.
Pro/Engineer gives you the choice to write your plugins as standalone
programs ("exe"s) or dynamic libraries ("dll"s). As EXEs communicate with
ProE via RPC, we'd prefer to make DLLs (where the functions are called
directly) for better performance.
When ProE loads a dll, it seems that main() does not get called. Instead,
user_initialize(), where the ProE-stuff shall be initialized, is called
directly. So I moved the gtk_init()-call from main() to user_initialize(),
giving NULLs as arguments.
And here finally comes my problem: This works fine as an exe, but lets ProE
crash somewhere else as dll.
When I comment out the gtk_init()-call, all is fine as long as no
gtk-function is called. When the call is active, a simple ProE-operation
crashes that has nothing to do with my code. So I assume, gtk_init modifies
memory where it shouldn't.
But: This only is true for HP UX, on the other platforms I could not
reproduce this or a similar problem, yet.
I tried to feed gtk_init() with fake parameters (argc and argv are not
present in user_initialize()), but this had no effect.
Then I tried to compile newer versions of gtk (1.3.15 and 2.3.0, currently
1.2.10), but they seem to require "pkgconfig", which didn't comile on my HP
UX in turn.
I compiled gtk and glib (versions 1.2.10) with the native HP UX compiler and
the +z-flag to produce position independent code and link everything
statically. At first I compiled with gcc, but there were crashes. I assume
they were caused from incompatitibility with the ProE-libararies which I also
have to link against and which are certainly not compiled with gcc.
And: glib is compiled without thread-support. I tried pth-1.4.1, but the
glib-configure-script didn't find it.
I know, chances are few that someone has the same problem than I have, but
it's worth a try. :-)
Thank you for any help,
Markus Moser
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]