Link to home
Start Free TrialLog in
Avatar of clu82
clu82

asked on

Calling a function in a .pbd from C#

Does anyone have any code samples or a web site that will show me how to call into a .pbd file to execute a function? The function works from PB, but now I need to call it from C# also.

I tried this code:

[DllImport("C:\\Program Files\\PBBase\\update1.pbd", EntryPoint = "run_update")]
static extern bool run_update(bool b1, bool b2, bool b3, bool b4, bool b5, bool b6, bool b7);

public void CallPBUpdate()
{
run_update(false,false,false,false,false,false,false);
}


but am getting this error:
An attempt was made to load a program with an incorrect format. (Exception from HRESULT: 0x8007000B)

Info:
C# 2.0
PB 10.0
Win XP

tia,
clu

ASKER CERTIFIED SOLUTION
Avatar of tr1l0b1t
tr1l0b1t

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Hi,

If you have source code you can compile powerbuilder application in machine code (.dll) instead of (.pbd) and try to call the same function from dll.

I am not sure just guessing....

Regards,
Sandeep