|
马上注册登录,享用更多网站功能!
您需要 登录 才可以下载或查看,没有帐号?立即注册
x
试编了一小段程序,UG里运行dll时提示:“内存访问冲突”。
请教高手!是什么问题?
#include <uf.h>
#include <uf_ui.h>
#include <uf_curve.h>
#if ! defined ( __hp9000s800 ) && ! defined ( __sgi ) && ! defined ( __sun )
# include <strstream>
# include <iostream>
# include <fstream>
# include <string>
using namespace std;
using std:strstream;
using std::endl;
using std::ends;
using std::cerr;
#else
# include <strstream.h>
# include <iostream.h>
#endif
#include "curves.h"
//----------------------------------------------------------------------------
// Activation Methods
//----------------------------------------------------------------------------
// Explicit Activation
// This entry point is used to activate the application explicitly, as in
// "File->Execute UG/Open->User Function..."
extern "C" DllExport void ufusr( char *parm, int *returnCode, int rlen )
{
/* Initialize the API environment */
int errorCode = UF_initialize();
if ( 0 == errorCode )
{
/* TODO: Add your application code here */
/*create a new prt*/
char part_name[133]="d:\\kk.prt";
int units=1;
tag_t part;
UF_PART_new(part_name,units,&part);
UF_CURVE_spline_t splinedata;
tag_p_t splinetag;
int *num_states;
UF_CURVE_state_p_t *states=NULL;
splinedata.is_rational=1;
splinedata.num_poles=4;
splinedata.order=3;
splinedata.poles[0][0]=111;
splinedata.poles[0][1]=31;
splinedata.poles[0][2]=46;
splinedata.poles[0][3]=1;
splinedata.poles[1][0]=107;
splinedata.poles[1][1]=46;
splinedata.poles[1][2]=46;
splinedata.poles[1][3]=1;
splinedata.poles[2][0]=98;
splinedata.poles[2][1]=37;
splinedata.poles[2][2]=46;
splinedata.poles[2][3]=1;
splinedata.poles[3][0]=100;
splinedata.poles[3][1]=35;
splinedata.poles[3][2]=46;
splinedata.poles[3][3]=1;
UF_CURVE_create_spline (&splinedata,splinetag,num_states,states);
}
errorCode = UF_terminate();
/* Print out any error messages */
PrintErrorMessage( errorCode );
}
//----------------------------------------------------------------------------
// Utilities
//----------------------------------------------------------------------------
// Unload Handler
// This function specifies when to unload your application from Unigraphics.
// If your application registers a callback (from a MenuScript item or a
// User Defined Object for example), this function MUST return
// "UF_UNLOAD_UG_TERMINATE".
extern "C" int ufusr_ask_unload( void )
{
return( UF_UNLOAD_UG_TERMINATE );
}
} |
|