More DLL and global var problems

Steve Jorgensen steve@khoral.com
Mon Nov 1 16:17:00 GMT 1999


	I managed to get DLL's working on our non-X based
	libraries, but I'm having a problem with our X libraries.
	Khoros has a large number of it's own widgets, defined in
	several different libraries, and though it's in C, 
	it's possible to do support basic inheritance via
	Xt.

	Each widget has a class initializer which is a global
	variable.  This initializer is used by subclasses to initialize
	the "superclass" part of the variable.  Anyway, the problem
	I'm seeing is this.  If the superclass initializer variable
	is in a different DLL than the current DLL I'm compiling, I
	get the following while compiling:

Browser.c:174: Internal compiler error, output_operand_lossage `invalid expression on as operand'
{standard input}: Assembler messages:
{standard input}:1150: Warning: Partial line at end of file ignored

	and then it just hangs.

	The relevant part of the code is as follows:

171:XvwBrowserWidgetClassRec xvwBrowserWidgetClassRec =
172:{
173:  {
174:    (WidgetClass) &xvwManagerWidgetClassRec,
	....

	The xvwManagerWidgetClassRec is the global variable from the
	other DLL, and it is declared with __declspec(dllexport) when
	I compile the library containing it, and __declspec(dllimport) when
	it is being used by other libraries/applications.  

	If the above example isn't clear enough, you can go look at
	Core.c in the X11R6 distribution and search for where the
	widgetClassRec variable is defined and initialized.

	So, any idea what I'm doing wrong?  I have a feeling these
	variables have to be treated differently, because I can't
	find any of this __declspec(dllexport) or __declspec(dllimport)
	in the X include files, and yet it does subclassing the
	same way, and is distributed in DLL form.

	Should I not do the special gcc declaration for these variables?
	If that's the case, how do you tell which global vars need
	the special externing and which don't?

						Steve

-- 
-----------------------------------------------------------
Steven Jorgensen      steve@khoral.com	    steve@haunt.com
------------------------------+----------------------------
Khoral Research Inc.          | PHONE: (505) 837-6500
6200 Uptown Blvd, Suite 200   | FAX:   (505) 881-3842
Albuquerque, NM 87110         | URL: http://www.khoral.com/
-----------------------------------------------------------

--
Want to unsubscribe from this list?
Send a message to cygwin-unsubscribe@sourceware.cygnus.com



More information about the Cygwin mailing list