Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Re: Import a DLL from C# to Perl

by syphilis (Archbishop)
on May 08, 2018 at 02:21 UTC ( [id://1214185]=note: print w/replies, xml ) Need Help??


in reply to Import a DLL from C# to Perl

With this code I was able to call the dll from a C code

There are a couple of alternative approaches you could consider.
If you can achieve what you want in C code, then you should be able do the same in Perl, using Inline::C.
OTOH, if the wrapper code that you have is C++, then maybe Inline::CPP would be better.

If this is just about utilizing user32.dll's MessageBoxA function, then the Inline::C cookbook contains this example.

I've nothing against Win32::API - it's just that I've never managed to bring myself to persevere with it.
I'm therefore unable to provide any help with that particular module.

Cheers,
Rob

Replies are listed 'Best First'.
Re^2: Import a DLL from C# to Perl
by BrowserUk (Patriarch) on May 08, 2018 at 08:29 UTC
    If this is just about utilizing user32.dll's MessageBoxA function, then the Inline::C cookbook contains this example.

    Win32 can also do that:

    use Win32;; Win32::MsgBox( "Hi, from perl\nWhat can I do for you today?", MB_ICONQ +UESTION );;

    With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
    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". The enemy of (IT) success is complexity.
    In the absence of evidence, opinion is indistinguishable from prejudice. Suck that fhit
Re^2: Import a DLL from C# to Perl
by paulorfmmb (Acolyte) on May 08, 2018 at 16:31 UTC
    I tried using Inline::C and Inline::CPP and I get the same result. Looks like Perl doesn't have access to something from the C# enviroment. And it is not about the MessageBox, I'm just using it as an example.
      I tried using Inline::C and Inline::CPP and I get the same result

      According to what I found on StackOverflow the error is simply that a file cannot be found.
      When you run the perl script, is it running in the exact same shell that successfully runs the C/C#/C++ programs ?
      I'm thinking that the success you experience with the C/C#/C++ programs will depend upon certain environment variables being set correctly ... and that the failure you experience when running the perl script arises because one or more of those environment variables is no longer set (or has been altered).

      Cheers,
      Rob
        No, not the same shell. My C++ and C# code were build with VS. The C code that I could run as a test I used DEV-C++.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1214185]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others lurking in the Monastery: (5)
As of 2024-04-25 11:59 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found