Re: DLL function loading issue



Sorry but it did not change anything.
it seems that issue is with static keyword... i do not understand why, but it is not with __stdcall.

Al.

Abdo Haji-Ali wrote:
"--== Alain ==--" <nospam@xxxxxxxxxxx> wrote in message
news:eBUQL1L5GHA.4196@xxxxxxxxxxxxxxxxxxxxxxx
Here is an updated version of my code with typedef and the relative errors
:
// --- myclass.h
typedef LPTSTR (__stdcall *FUNCT_LocGetString)(long);
From MSDN:
"/Gd, the default setting, specifies the C calling convention for all
functions except C++ member functions and functions marked __stdcall or
__fastcall."
So unless you changed the compiler options or specified __stdcall in the
declaration of your function you're most likely to get a runtime error

<code sniped>

VC raises following errors :
CARDLLWrapper.obj : error LNK2001: unresolved external symbol "private:
static char * (__stdcall* CARDLLWrapper::LocGetString)(long)"
(?LocGetString@CARDLLWrapper@@0P6GPADJ@ZA)

CARDLLWrapper.obj : error LNK2001: unresolved external symbol "private:
static struct HINSTANCE__ * CARDLLWrapper::m_hlibLoc"
(?m_hlibLoc@CARDLLWrapper@@0PAUHINSTANCE__@@A)
This has nothing to do with the function pointer nor the function itself,
but rather with the declaration of the static variable inside the class.
From what I can see this varaible isn't "defined" anywhere. So what you need
to do is to define it somewhere (in one of your source files) exacly once
(Much like a function: It has a declaration and a definition). Your
definition should look something like this:
FUNCT_LocGetString CARDLLWrapper::LocGetString; // Possibly with
initialization

.



Relevant Pages

  • Re: (part 21) Han from China answers your C questions
    ... not supplying a prototype for main. ... of a definition of that function specifies that no information about ... declared function has no parameters means this declaration does ... Syntactically, it does in fact match the K&R-style syntax rule, ...
    (comp.lang.c)
  • Re: How do java programmers cope with java missing c++ const?
    ... to pass a const reference to a mutable object as can be done in c++. ... I also found the 'const' keyword in C++ to be very useful, ... It is a modifier used to change the characteristics to ... modified and must be initialized at the point of declaration. ...
    (comp.lang.java.programmer)
  • Re: Statement functions
    ... It would be a simple way to avoid ambiguity with ... array assignment, especially in the case of an internal subprogram. ... same name and you forget to give a local type declaration ... As for the keyword STMT, I'm sure that STATEMENT is a better Fortran-istic choice. ...
    (comp.lang.fortran)
  • Re: [announcement] SYSAPI and SYSSVC for Windows
    ... use dangling pointers -- so the & operator in C or C++ is more like ... > the array declaration. ... if declared so or if allocated in the heap by ... We should, instead, have allowed the "aliased" keyword on parameters. ...
    (comp.lang.ada)
  • Re: D5 Constant expression expected
    ... suggested but with the intention of keeping the Const keyword. ... I personally would like to see Const kept for the declaration of 'true' ... identify local variables that have a local scope but a global lifetime. ...
    (comp.lang.pascal.delphi.misc)