I plan to write a installscript in which I call a dll inside the package. In my understanding, I need to do:
1. add key into Binary Table;
2. modify CustomAction table;
3. useDll(dllName) in script.
But I couldn't make it work. Can someone give me a little detailed explanation?
Thanks,
This is a ready-only archive of the InstallSite Forum. You cannot post any new content here. / Dies ist ein Archiv des InstallSite Forums. Hier können keine neuen Beiträge veröffentlicht werden.
calling dll in installscript
Started by
bluesky9898
, Jan 15 2004 17:41
8 replies to this topic
Posted 15 January 2004 - 18:24
In addition you will need to write script code that extracts the file form the binary table.
You have two simpler alternatives:
a) put the file in the Support Files section fo the IDE instead of the binary table. InstallShield will then extract it for you.
b) Don't use InstallScript but create a custom action that calls a dll, stored in the binary table. This is the simplest way if all you need to do is call the DLL. If you need extra code around your DLL call, you should use option a)
You have two simpler alternatives:
a) put the file in the Support Files section fo the IDE instead of the binary table. InstallShield will then extract it for you.
b) Don't use InstallScript but create a custom action that calls a dll, stored in the binary table. This is the simplest way if all you need to do is call the DLL. If you need extra code around your DLL call, you should use option a)
Stefan Krüger
InstallSite.org twitter facebook
Posted 15 January 2004 - 18:44
Stefan,
Thanks. I added dll to support file, in the script file:
#define DLL_FILE "testDll.dll"
prototype testDll.fnTestDll();
....
UseDLL (SUPPORTDIR^DLL_FILE);
n1 = fnTestDll();
UnUseDLL (SUPPORTDIR^DLL_FILE);
Dll code is: (Miscrofot Visual Studio C++ 6. Calling Convention is __stdcall)
TESTDLL_API int fnTestDll(void)
{
return 42;
}
I can see the loading of dll is successful. However, the function call fails.
What did I do wrong?
Thanks again.
Thanks. I added dll to support file, in the script file:
#define DLL_FILE "testDll.dll"
prototype testDll.fnTestDll();
....
UseDLL (SUPPORTDIR^DLL_FILE);
n1 = fnTestDll();
UnUseDLL (SUPPORTDIR^DLL_FILE);
Dll code is: (Miscrofot Visual Studio C++ 6. Calling Convention is __stdcall)
TESTDLL_API int fnTestDll(void)
{
return 42;
}
I can see the loading of dll is successful. However, the function call fails.
What did I do wrong?
Thanks again.
Posted 15 January 2004 - 19:24
CODE |
#define DLL_FILE "testDll.dll" NUMBER n1; NUMBER nResult; ... prototype NUMBER testDll.fnTestDll(); .... nResult = UseDLL (SUPPORTDIR^DLL_FILE); n1 = testDll.fnTestDll(); nResult = UnUseDLL(SUPPORTDIR^DLL_FILE); |
Edited by Glytzhkof, 15 January 2004 - 19:25.
Regards
-Stein Åsmul
-Stein Åsmul
Posted 15 January 2004 - 19:26
You say the calling convention is __stdcall. If things still don't work, try to specify cdecl instead:
CODE |
prototype cdecl NUMBER testDll.fnTestDll(); |
Regards
-Stein Åsmul
-Stein Åsmul
Posted 15 January 2004 - 21:26
I tried both and neither of them worked. Is there any other setting I need to consider? Does this mean I can't use MS Visual C++ dll project?
Do you have a small working example project which can be shared?
Thanks,
Do you have a small working example project which can be shared?
Thanks,
Posted 15 January 2004 - 22:22
I will see if I can dig up a test project. In the mean time I would try your script without using the DECLARE section. Just hard code the dll name in the script (just to verify).
Regards
-Stein Åsmul
-Stein Åsmul
Posted 15 January 2004 - 23:43
Glytzhkof,
Finally it worked. I need to put extern "c" to avoid function name mangled.
Thanks for your patience.
Finally it worked. I need to put extern "c" to avoid function name mangled.
Thanks for your patience.
Posted 15 January 2004 - 23:50
Ah, yeah. It might also work to add a *.def file to your project. See this article: http://www.installsh...ls-for-ipwi.asp
Edited by Glytzhkof, 15 January 2004 - 23:51.
Regards
-Stein Åsmul
-Stein Åsmul