Re: how to export this function?

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance

From: Nicky (Nicky_at_discussions.microsoft.com)
Date: 09/28/04


Date: Tue, 28 Sep 2004 06:31:03 -0700

Thank you dave.
Both are debug version.
Another question is when I use .def to export the interface, the exported
name is GetStringCode, but when I use __declspec(dllexport) __cdecl CString
GetStringCode(CString str1, CString str2) without .def file, after compile,
the Dependency shows the exported function is
GetStringCode@@?1CString@@?2CString@ and some other strange chars. It seems
vc6 uses some name mapping on it. How to resolve this ?

"David Lowndes" wrote:

> >I wrote a dll, but , it does not work correctly.
> >I created a Regular DLL using shared MFC DLL in vc6 and exprots one function
> >// in mydll.cpp
> >CString __cdecl GetStringCode(CString str1, CString str2);
> >...
> >// ----- Use it in another Dialog Based app
> >typedef CString (FAR __cdecl *PGetStringCode)(CString str1,CString str2);
> >...
> > CString str = pGetSC("1","2");
> > //Here, I debugged into the mydll, int function
> >GetStringCode(str1, str2), the str1="2" , str2="", this is not right.
>
> Nicky,
>
> Since you appear to be defining the function & pointer correctly in
> both the EXE & DLL there shouldn't be a mis-match with the calling
> convention (__cdecl).
>
> Are you perhaps mixing a debug build of the EXE/DLL with a release
> build of the other component, or building one component with a
> different version of the compiler (both of which are big problems in
> this scenario)?
>
> Dave
> --
> MVP VC++ FAQ: http://www.mvps.org/vcfaq
>



Relevant Pages

  • Re: define_method and instance variable maddness
    ... use 'define_method', but then their methods cease to take blocks, ... enclose scope which cannot be freed, and are a pain in the butt to ... def add_personnel ... it's faster to debug by light years since you can dump ...
    (comp.lang.ruby)
  • Re: define_method and instance variable maddness
    ... def add_personnel ... it's faster to debug by light years since you can dump ...
    (comp.lang.ruby)
  • Re: Optimizing constants in loops
    ... def func: ... Could the "if debug" be optimized away on function invocation if debug ... The optimizer works in the way you describe above (which ...
    (comp.lang.python)