accessing dll's - a w prefix

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

accessing dll's - a w prefix

Christoph J. Bachinger
Hello,

I'm trying to access a dll,
via subclassing external libraring.
The opening of the dll works fine,
but sending messages to the dll fails
with failure-code 1 if I look in the method: invalidCall
there is a commend to check a w prefix,
what does it mean?

Thanks a lot,
Katjana


Reply | Threaded
Open this post in threaded view
|

Re: accessing dll's - a w prefix

Blair McGlashan
"Katjana T." <[hidden email]> wrote in message
news:[hidden email]...
> Hello,
>
> I'm trying to access a dll,
> via subclassing external libraring.
> The opening of the dll works fine,
> but sending messages to the dll fails
> with failure-code 1 if I look in the method: invalidCall
> there is a commend to check a w prefix,
> what does it mean?

Many Win32 APIs have Ascii and Unicode versions, with the functions being
differentiated by having A or W (respectively) appended* to the function
name you see in the documentation. This applies to almost all functions that
take on or more string arguments, or which have structure arguments with
embedded strings, or which result in callbacks involving strings. In other
words the correct name for the function is often formed from the name you
see in MSDN plus A or W, for example OutputDebugStringA. Generally speaking
you will want to use the A version except in the few cases where only a
Unicode version exists, and such functions do not normally have the suffix.

Regards

Blair

*The comment erroneously describes the extra letter as a prefix, whereas it
is of course a suffix. I will get this corrected.


Reply | Threaded
Open this post in threaded view
|

Re: accessing dll's - a w prefix

Bill Schwab-2
In reply to this post by Christoph J. Bachinger
Katjana,

> I'm trying to access a dll,
> via subclassing external libraring.
> The opening of the dll works fine,
> but sending messages to the dll fails
> with failure-code 1 if I look in the method: invalidCall
> there is a commend to check a w prefix,
> what does it mean?

Just a guess (and you quoted it correctly), that should probably read "w
suffix", and refers to ASCII (A) vs Unicode/wide (W) handling of strings.
It's quite common for header files to define SomeFunction() as
SomeFunctionA() or SomeFunctionW().  When this is the case, you will need to
point Dolphin at the A or W function, as appropriate.

A dependency viewer that shows DLL entry points can be a big help.
Dumpbin.exe can list functions exported by a DLL, or you can read header
files to find the "real" function names.

Have a good one,

Bill

--
Wilhelm K. Schwab, Ph.D.
[hidden email]


Reply | Threaded
Open this post in threaded view
|

Re: accessing dll's - a w prefix

Christoph J. Bachinger
Bill Schwab schrieb:

> Katjana,
>
>
>>I'm trying to access a dll,
>>via subclassing external libraring.
>>The opening of the dll works fine,
>>but sending messages to the dll fails
>>with failure-code 1 if I look in the method: invalidCall
>>there is a commend to check a w prefix,
>>what does it mean?
>
>
> Just a guess (and you quoted it correctly), that should probably read "w
> suffix", and refers to ASCII (A) vs Unicode/wide (W) handling of strings.
> It's quite common for header files to define SomeFunction() as
> SomeFunctionA() or SomeFunctionW().  When this is the case, you will need to
> point Dolphin at the A or W function, as appropriate.
>
> A dependency viewer that shows DLL entry points can be a big help.
> Dumpbin.exe can list functions exported by a DLL, or you can read header
> files to find the "real" function names.
>
> Have a good one,
>
> Bill
>
> --
> Wilhelm K. Schwab, Ph.D.
> [hidden email]
>
>
>

Many thanks for the advice. But it won't work.
It seems so simple. What do I wrong. I still
get the above error code 1 in method invalid call
calling doRayInit ....

I tried Dumpbin and PE Exlorer with following results below.

This is what I'm evaluate
dll := GammaRayLibrary default.
dll doRayInit: 1 level: 2 password: 12149261.

GammaRayLibrary instance method
doRayInit: vpId level: level password: password
        <stdcall: sdword _DoRayInit dword dword dword>
        ^self invalidCall

Visual C++ Definition
GAMMADLL_FUNC int STDCALL _DoRayInit(UINT nVpId, UINT nLevel, UINT nPass);

Dumpbin result for GAMMADLL

   Section contains the following exports for GAMMADLL.DLL

            0 characteristics
     3F86BDAF time date stamp Fri Oct 10 16:09:51 2003
         0.00 version
            1 ordinal base
           36 number of functions
           36 number of names

     ordinal hint RVA      name

           1    0 0000FE30 _DoRay@0
           2    1 00010DA0 _DoRayAddPolyLineProc@12
           3    2 00010E40 _DoRayAddWindow@4
           4    3 0000FEB0 _DoRayAviConvert@32
           5    4 0000FE20 _DoRayCreateAppWindow@8
           6    5 000104A0 _DoRayCreateBackground@8
           7    6 00010180 _DoRayCreateCamera@8
           8    7 00010AB0 _DoRayCreateFrame@8
           9    8 0000FF70 _DoRayCreateLight@8
          10    9 000105E0 _DoRayCreateOptions@8
          11    A 00010BC0 _DoRayDeleteFrame@4
          12    B 0000FF20 _DoRayEnumerateLights@12
          13    C 00010540 _DoRayGetBackground@8
          14    D 00010270 _DoRayGetCamera@8
          15    E 00010B10 _DoRayGetFrame@20
          16    F 00010040 _DoRayGetLight@8
          17   10 00010640 _DoRayGetOptions@8
          18   11 00011190 _DoRayGetSceneBox@8
          19   12 0000FDD0 _DoRayInit@12
          20   13 0000FE40 _DoRayMakro@4
          21   14 00011040 _DoRayRemoveWindow@4
          22   15 00010C00 _DoRayRender@16
          23   16 00011130 _DoRaySetActiveWindow@4
          24   17 0000FEF0 _DoRaySetAppEvtLoop@4
          25   18 00010590 _DoRaySetBackground@8
          26   19 00010370 _DoRaySetCamera@8
          27   1A 0000FE10 _DoRaySetIdleProc@4
          28   1B 000100E0 _DoRaySetLight@8
          29   1C 000108C0 _DoRaySetOptions@8
          30   1D 0000FEE0 _DoRayTestMemory@4
          31   1E 0000FE60 _DoRayTgfCode@12
          32   1F 0000FE80 _DoRayTgfEnd@4
          33   20 0000FEA0 _DoRayTgfEndAdd@4
          34   21 0000FE50 _DoRayTgfStart@8
          35   22 0000FE90 _DoRayTgfStartAdd@4
          36   23 0000FF00 _DoRayUpdateUI@0

   Summary

       3CA000 .data
        12000 .rdata
        32000 .reloc
        13000 .rsrc
       37E000 .text
        11000 _TEXT_HA


Any advice or idea would be very nice


Reply | Threaded
Open this post in threaded view
|

Re: accessing dll's - a w prefix

Blair McGlashan
Katjana

You wrote in message news:bn6bcg$tmag5$[hidden email]...

> ...
> Many thanks for the advice. But it won't work.
> It seems so simple. What do I wrong. I still
> get the above error code 1 in method invalid call
> calling doRayInit ....
>
> I tried Dumpbin and PE Exlorer with following results below.
>...
>           19   12 0000FDD0 _DoRayInit@12
>...

In which case you want:

GammaRayLibrary>>doRayInit: vpId level: level password: password
        <stdcall: sdword '_DoRayInit@12' dword dword dword>
        ^self invalidCall

The function name in the Dolphin external method must be exactly the same as
shown by DumpBin, including any decoration/name mangling. Sometimes, as in
this case, this may make it necessary to quote the function name.

Regards

Blair


Reply | Threaded
Open this post in threaded view
|

Re: accessing dll's - a w prefix

Christoph J. Bachinger
Blair McGlashan schrieb:

> Katjana
>
> You wrote in message news:bn6bcg$tmag5$[hidden email]...
>
>>...
>>Many thanks for the advice. But it won't work.
>>It seems so simple. What do I wrong. I still
>>get the above error code 1 in method invalid call
>>calling doRayInit ....
>>
>>I tried Dumpbin and PE Exlorer with following results below.
>>...
>>          19   12 0000FDD0 _DoRayInit@12
>>...
>
>
> In which case you want:
>
> GammaRayLibrary>>doRayInit: vpId level: level password: password
>         <stdcall: sdword '_DoRayInit@12' dword dword dword>
>         ^self invalidCall
>
> The function name in the Dolphin external method must be exactly the same as
> shown by DumpBin, including any decoration/name mangling. Sometimes, as in
> this case, this may make it necessary to quote the function name.
>
> Regards
>
> Blair
>
>

Thanks very much Blair now it works fine.
Maybe to be save for future silly questions on this syntax stuff
it would be a good idea to add at end of the ExternalLibrary Class
comment the following lines.

Calling Examples
        <stdcall: hresult SetWindowTheme handle lpwstr lpwstr>
        <stdcall: sdword '_DoRayInit@12' dword dword dword>

Thanks again Katjana and Christoph