title: Calling external function from DLL with PowerBuilder 10.0 error
body: <p>I have created a DLL using Visual C++ 2008 that creates two external functions.  Using python I have created two separate executable functions to run these.  When using PowerBuilder to call the function, the first executable runs fine.  The second executable results in a runtime error: <code>error calling external function %s</code>.  I use a <code>.def</code> file and have the correct ordinals for each function.  Any advice?</p>
  
  <p>The function declarations in C are as follows (sorry they are quite long):</p>
  
  <pre><code>extern "C" int __stdcall start_proctor( double points[], double weights[], double opoints[],  double &amp;SG, char sg_estimated[], double &amp;smooth, char ptitle[], double &amp;pheight, double &amp;pwidth, char save_location[], int &amp;show, int &amp;ZV, char roundM[], char roundD[], int &amp;zoom, char cwd[], int &amp;x_scale_major_tick,int &amp;y_scale_major_tick, char points_of[], char points_color[], char points_type[], int &amp;points_size, char curve_of[], char curve_color[], int &amp;curve_alpha, int &amp;curve_size, char grid_of[], char grid_color[], int &amp;grid_alpha, int &amp;grid_x_dash, int &amp;grid_y_dash, char opt_of[], char opt_color[], int &amp;opt_alpha, int &amp;opt_x_dash, int &amp;opt_y_dash, int &amp;x_scale_major_tick_c, int &amp;y_scale_major_tick_c, char points_of_c[], char points_color_c[], char points_type_c[], int &amp;points_size_c, char curve_of_c[], char curve_color_c[], int &amp;curve_alpha_c, int &amp;curve_size_c, char grid_of_c[], char grid_color_c[], int &amp;grid_alpha_c, int &amp;grid_x_dash_c, int &amp;grid_y_dash_c, char opt_of_c[], char opt_color_c[], int &amp;opt_alpha_c, int &amp;opt_x_dash_c, int &amp;opt_y_dash_c, int &amp;return_default, int &amp;splash, double &amp;optmoisture, double &amp;maxdd,  double &amp;percent_oversized, double &amp;o_SG , double &amp;o_moisture, double &amp;o_optmoisture, double &amp;o_maxdd, int &amp;oversized_flag, int &amp;debug, char c_output[] );
  
  extern "C" int __stdcall start_grain_size( char dsn_name[], char userID[], char passwd[], double test_data[], int &amp;td_length, double upper_bound[], int &amp;ub_length, double lower_bound[], int &amp;lb_length, char envelope[], char specification[], char pointmarker[], char splinemarker[], char display[], char scale[], char units[], char xlabel[], char direction[], char maximum_density_line[], int &amp;pan, char title[], char save_location[], char cwd[], int &amp;show, double &amp;width, double &amp;height, char output[] );
  </code></pre>
  
  <p>In powerbuilder the external function declarations are:</p>
  
  <pre><code>Function int start_proctor(ref double points[3,8], ref double weigthts[8], ref double opoints[3,8], ref double sg, ref string sg_estimated, ref double smooth, ref string ptitle, ref double pheight, ref double pwidth, ref string save_location, ref int show, ref int zv, ref string roundm, ref string roundd, ref int zoom, ref string cwd, ref int li_x_scale_major_tic, ref int li_y_scale_major_tic, ref string ls_points_of, ref string ls_points_color, ref string ls_points_type, ref int li_points_size, ref string ls_curve_of, ref string ls_curve_color, ref int li_curve_alpha, ref int li_curve_size, ref string ls_grid_of, ref string ls_grid_color, ref int li_grid_alpha, ref int li_grid_x_dash, ref int li_grid_y_dash, ref string ls_opt_of, ref string ls_opt_color, ref int li_opt_alpha, ref int li_opt_x_dash, ref int li_opt_y_dash, ref int li_x_scale_major_tic_t, ref int li_y_scale_major_tic_t, ref string ls_points_of_t, ref string ls_points_color_t, ref string ls_points_type_t, ref int li_points_size_t, ref string ls_curve_of_t, ref string ls_curve_color_t, ref int li_curve_alpha_t, ref int li_curve_size_t, ref string ls_grid_of_t, ref string ls_grid_color_t, ref int li_grid_alpha_t, ref int li_grid_x_dash_t, ref int li_grid_y_dash_t, ref string ls_opt_of_t, ref string ls_opt_color_t, ref int li_opt_alpha_t, ref int li_opt_x_dash_t, ref int li_opt_y_dash_t, ref int li_return_default, ref int li_splash, ref double optmoisture, ref double maxdd, ref double pover, ref double osg, ref double om,  ref double o_optmoisture, ref double o_maxdd, ref int oversized_flag, ref int debug_flag, ref string output) LIBRARY "ELMTREE_EXTERNAL.dll" ALIAS FOR "start_proctor;ansi"
  
  Function int start_grain_size(ref string dsn_name, ref string userid, ref string passwd, ref double test_data[], ref int td_length, ref double upper_bound[], ref int ub_length, ref double lower_bound[], ref int lb_length, ref string envelope, ref string specification, ref string pointmarker, ref string splinemarker, ref string display, ref string scale, ref string units, ref string xlabel, ref string direction, ref string maximum_density_line, ref int pan, ref string title, ref string save_location, ref string cwd, ref int show, ref double width, ref double height, ref string output) LIBRARY "ELMTREE_EXTERNAL.dll" ALIAS FOR "start_grain_size;ansi"
  </code></pre>
  
  <p>start_grain_size results in the error</p>