Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C Programming > extern access to variable

Reply
Thread Tools

extern access to variable

 
 
smackdab
Guest
Posts: n/a
 
      12-08-2003
Hi, I am using MSVC to compile GD and I think I am down to my last problem
(we'll see

I can compile libgd.dll and libgd.lib ok but a gdtest.exe program that
refers to extern font variables
are not defined and I have no idea how this should work...sorry for the
confusing email, the
more I write, the worse it becomes

SHORT VERSION>
My gdtest.exe program's .map file does not list gdFontGiant and seems to
only list functions
that are visabally called in the source. There is a "enable function level
linking" setting, but it
is NOT on...How does a .exe refer to a char [] created in a .dll? (does it
come from the .lib?)
Does the .lib hold data variables?
If I don't link in the libgd.lib, I get unresolved externals except for the
variables, this call does
nothing: extern gdFontPtr gdFontGiant;
gdFontPtr is defined as a * to a struct, but gdFontGiant is a char[] defined
in libgd.c(libgd.lib).
----------------------

LONG VERSION> Here are the details:

Here is a sample from the .dll source that creates a font character (stuff
deleted)
"gdFontGiant" is what I want to access from gdtest.exe...

#include "gdfontg.h"
char gdFontGiantData[] = {
/* Char 0 */
0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0,
};
gdFont gdFontGiantRep = {
256,
0,
9,
15,
gdFontGiantData
};

gdFontPtr gdFontGiant = &gdFontGiantRep;

------------------------------------------------------
Here is the gdfontg.h referenced above:

#ifndef _GDFONTG_H_
#define _GDFONTG_H_ 1
#ifdef __cplusplus
extern "C"
{
#endif
#include "gd.h"
extern gdFontPtr gdFontGiant;
#ifdef __cplusplus
}
#endif
#endif

------------------------------------------------------
And the .def file that exports gdFontGiant

; LIBGD.DEF - module definition file

LIBRARY LIBGD
DESCRIPTION 'LIBGD.DLL'
EXPORTS
gdAlphaBlend
gdDPExtractData
gdFontGiant

------------------------------------------------------

gdFontGiant *seems* to be in the .map .lib and .dll files if I bring
up a text editor and search for the gdFontGiant string...

------------------------------------------------------

The gdtest.exe program, just has
#include "gdfontg.h"
To include the extern part
extern gdFontPtr gdFontGiant;

But, when I am in the debugger gdFontGiant isn't defined
I have added libgd.lib in the link options, and no compiler errors

Is gdFontGiant statically compiled into gdtest.exe ?
Or does it come from the DLL? (doesn't seem likely as
it isn't a function...)

Anything is helpful!!!







 
Reply With Quote
 
 
 
 
Jack Klein
Guest
Posts: n/a
 
      12-08-2003
On Sun, 7 Dec 2003 18:07:51 -0800, "smackdab" <(E-Mail Removed)>
wrote in comp.lang.c:

> Hi, I am using MSVC to compile GD and I think I am down to my last problem
> (we'll see
>
> I can compile libgd.dll and libgd.lib ok but a gdtest.exe program that
> refers to extern font variables
> are not defined and I have no idea how this should work...sorry for the
> confusing email, the
> more I write, the worse it becomes


[snip]

You need to take this to a Windows programming group like
news:comp.os.ms-windows.programmer.win32, or one of Microsoft's
support groups in the news:microsoft.public.vc.* family. This is a
compiler and Windows issue, not a language one.

--
Jack Klein
Home: http://JK-Technology.Com
FAQs for
comp.lang.c http://www.eskimo.com/~scs/C-faq/top.html
comp.lang.c++ http://www.parashift.com/c++-faq-lite/
alt.comp.lang.learn.c-c++ ftp://snurse-l.org/pub/acllc-c++/faq
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Difference of extern short *x and extern short x[]? Andre C Programming 5 07-17-2012 07:38 PM
extern variable vadnala@gmail.com C++ 4 01-30-2007 02:52 AM
extern struct variable Bangalore C++ 5 09-06-2005 01:45 AM
extern global variable defined within namespace Dan Elliott C++ 4 12-08-2004 10:21 AM
extern const char * vs. extern const char []http://tinyurl.com/47e3k Thomas Matthews C++ 5 08-02-2004 10:36 AM



Advertisments