cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
tomerdr
Level 6

How to throw exception from c++ dll?

Hi

Is it possible to raise an 'exception'(could be com error) from a c++ dll
in such that i can trap it in install script?


Thanks in advance
Labels (1)
0 Kudos
(3) Replies
RobertDickau
Flexera Alumni

What kind of project? I haven't tried it, but it seems it might work with an InstallScript project, but I'm a little less hopeful about MSI...
0 Kudos
tomerdr
Level 6

I know how to raise and error,i just want to know if install script can handle it

i can also return HRESULT,than is it possible to throw exception using installscript?
0 Kudos
MichaelU
Level 12 Flexeran
Level 12 Flexeran

One of the big rules about exceptions and C++ is that it's a bad idea to cross DLL boundaries with them. COM uses HRESULTs to indicate failure cases that higher level languages will tend to turn into exceptions. If you're using a COM call from InstallScript to get into your C++, returning a failing HRESULT might already do this. If you're using a direct DLL load and call, I expect it won't, but you can check the return value and turn it into an exception on the InstallScript side yourself.
0 Kudos