in reply to Perl program calling external .dll functions

I don't know what «String» is — it's not a standard C type or a WinAPI type — but it's definitely not the same as «uint32_t» ("L").

I don't know what «Long» is — it's not a standard C type or a WinAPI type either — but it's not necessarily the same as «uint32_t» ("L").

Could you provide more information about those types? Also, could you find out what calling convention is used? Win32::API assumes __stdcall unless you tell it it's __cdecl.

Replies are listed 'Best First'.
Re^2: Perl program calling external .dll functions
by manojghosh (Novice) on Mar 18, 2011 at 05:17 UTC
    simply the the .dll function is written in C++ and 2 string type arguments are passed through it. and it has a long return type. actually this .dll behaves fine with calling from VB6.0 but trying with perl, interpreter crashes in its call or return 0 on passing argument type mentioned as 'P'(Pointer to string).

      Assuming the STL even defines the internal storage format of a String, I don't know what it is. Whatever it is, it's definitely not a uint32_t as you're telling Win32::API it is.

      "P" passes a pointer to the a copy of the scalar's string buffer. Don't know if your String is compatible with what you are passing were you to use "P". But you're not using "P". You're using "L".

      You've provided no useful data about the type. You didn't provide the calling convention used.

      I think you'd be much better off using Inline::CPP.

        Given the mention of Visual Basic, I'd assume that the String type mentioned is a the VB type String. Passed by reference this would render an address, which on a 32-bit platform will usually come through successfully as a 32-bit numeric. Not a great idea, but it would mostly work.

        See kb106553 for some info.


        Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
        "Science is about questioning the status quo. Questioning authority".
        In the absence of evidence, opinion is indistinguishable from prejudice.