[galib] Building GALib DLL: GAID is a problem!
Peter Jay Salzman
p at dirac.org
Fri Oct 26 15:33:25 EDT 2007
On Fri 26 Oct 07, 2:20 PM, Peter Jay Salzman <p at dirac.org> said:
> Hi all,
>
> I've compiled a GALib DLL (which actually exports symbols), but so far, I've
> not been able to *use* the DLL. However, there are 2 specific questions I'd
> like to ask.
>
>
> First Question:
>
> I've placed "GA_DLLDECL" in every non-template class definition except
> for "GAID". When I change this definition:
>
> class GAID
> {
> ...
>
> to this:
>
> class GA_DLLDECL GAID
> {
> ...
>
> I get the following compile time error:
>
>
> gaid.h(30) : error C2470: 'GAID' :
> looks like a function definition, but there is no parameter list;
> skipping apparent body
>
> I understand what the compiler is telling me. I just don't know how to
> "fix" it, since it doesn't look like a parameterless function to me.
>
>
>
> Second Question:
>
> In the project settings, I use in Properties | C/C++ | Command Line:
>
> /D "COMPILE_GALIB_AS_DLL"
> /D "_CRT_SECURE_NO_DEPRECATE"
>
> However, when I look in gaconfig.h at this code:
>
> #if defined(COMPILE_GALIB_AS_DLL)
> #define GA_DLLDECL __declspec(dllexport) <--- greyed out
> #elif defined(USE_GALIB_AS_DLL)
> #define GA_DLLDECL __declspec(dllimport) <--- greyed out
> #else
> #define GA_DLLDECL <--- colored
> #endif
>
> Because the 2nd line is greyed out and the 6th line is colored, it looks
> like VC++ is not seeing my #define for COMPILE_GALIB_AS_DLL.
>
> Furthermore, when I let the mouse hover over this line of code:
>
> class GA_DLLDECL GAID
>
> a box pops up saying "#define GA_DLLDECL", not "__declspec(dllexport)".
> So it really really seems like VS is not seeing my #define.
>
>
> I noticed many similar question in the archives, but the answers are either
> non-applicable (I'm not using gcc) or else not correct (I'm already
> compiling this as a C++ program).
>
> Help?
>
> Thanks!
> Pete
Figured it out. And this would answer many of the questions asked about
this particular class over the years.
You need to #include "gaconfig.h" in gaid.h. Otherwise GA_DLLDECL has no
definition. The compiler thinks it's a function called GAID that
returns a class called GA_DLLDECL. The next character is a "{" which starts
the function body, but since there's no "()", there's no parameter list.
Bingo!
I've successfully created the DLL.
I'm still getting an unresolved reference to a void __cdecl
GARandomSeed(unsigned int)" when compiling an example program. Figuring
that out right now...
This has been a fairly painful experience. Has development stopped on
GALib?
And why does the mailing list require registration if the messages are being
moderated by hand?
Pete
More information about the galib
mailing list