Page 1 of 1

Call dll function

Posted: Tue Jan 18, 2011 3:30 am
by Ghyath
Dear,

I am using install aware to create an installer for the project i am working on.
I am trying to use the CallDllFunction, but it is not working with me at all.

Any help will be appreciated.

Re: Call dll function

Posted: Tue Jan 18, 2011 3:59 am
by bokkie
A lot depends on what you're trying to call and the parameters you are using. Can you describe the problem in more detail and perhaps give us the MSIcode fragment you're trying to use? There are many reasons why the call dll function doesn't work and many can be attributed to incorrect calling syntax.

Re: Call dll function

Posted: Tue Jan 18, 2011 4:59 am
by Ghyath
I created a class Library in C# that has static class called InstallerFunctions, with a static method called InstallerTestA that has no return value and no parameters.
I added [assembly: ComVisible(true)] in the AssemblyInfo.cs

I am using the below command
Call DLL Function ->InstallerTestA

I put the dll next to the installer when i run it

Re: Call dll function

Posted: Tue Jan 18, 2011 5:50 am
by bokkie
My apologies if I'm probably quoting incorrectly but I seem to recall that only methods that are compatible with __stdcall can be used? I believe that's the case with plugins but I'm not 100% certain what the rules are concerning calling dll's. In the past I've used C# to return a value but I've done that using IA's file bag to run an executable that returns a value and when I've needed more I've created a text file. It's been a while since I last needed to do anything like that. Does that help in any way?

Re: Call dll function

Posted: Tue Feb 01, 2011 11:59 pm
by Ghyath
Thank you for your help, can you show me a sample code

Re: Call dll function

Posted: Wed Feb 02, 2011 3:04 am
by bokkie
I'm sorry to say that I don't have any DLLs available as I've never written any that are compatible with IA's calling convention. I've certainly used the standard kernel DLLs in Windows but nothing I've hand-crafted of my own design. When I've wanted to do something specific using C# I create the C# assembly and I then I call it inside an executable. In my IA project, I then run the executable and I return a conventional return code which I use in my project's MSIcode. That's the only DLL stuff I've done for us in IA. You want the more "natural" kernel-style Windows calling convention and that's not something I've tried to do.

IA does include some template projects for creating plugins in C++ and Delphi. If you download the C++ one that might give you a clue as to how you need to define your own routines.