Development Kit API problems with DSGetProjectInfo

Post questions here relative to DataStage Server Edition for such areas as Server job design, DS Basic, Routines, Job Sequences, etc.

Moderators: chulett, rschirm, roy

Post Reply
jmzl666
Participant
Posts: 3
Joined: Wed Sep 20, 2006 9:36 am
Location: Mexico
Contact:

Development Kit API problems with DSGetProjectInfo

Post by jmzl666 »

Im Building a wraper in C# for the C++ API, im able to connecto to the server and get the ProjectList, even open a project, the problem is when a try to get the jobs of the Project, if i try to get the info of a Project with no jobs the return value is -1007 wich is ok, but if i try to get the info of a project with jobs I get a System.NullReferenceException, here is my code, thanks and sorry for the bad english.


[DllImport("vmdsapi.dll")] internal static extern int DSGetProjectInfo(IntPtr Project, int InfoType,[InAttribute(),Out()] IntPtr ProjectInfo);
public int GetProjectInfoDS(DSPROJECTINFO_VALUES Info)
{
int Resultado;
IntPtr Jobs;
try
{
Resultado=0;
Jobs=new IntPtr();
//DSDatos.PuntProy is apointer to the structure DSPROJECT
switch(Info)
{
case DSPROJECTINFO_VALUES.DSJ_JOBLIST:
Resultado=DSGetProjectInfo(DSDatos.PuntProy,DSJ_JOBLIST,Jobs);
break;
case DSPROJECTINFO_VALUES.DSJ_PROJECTNAME:
Resultado=DSGetProjectInfo(DSDatos.PuntProy,DSJ_PROJECTNAME,Jobs);
break;
case DSPROJECTINFO_VALUES.DSJ_HOSTNAME:
//Resultado=DSGetProjectInfo(DSDatos.PuntProy,DSJ_HOSTNAME,Jobs);
break;
};
return(Resultado);
}
catch(System.NullReferenceException Ex)
{
throw(Ex);
}
catch(Exception Ex)
{
throw(Ex);
}
}
jmzl666
Participant
Posts: 3
Joined: Wed Sep 20, 2006 9:36 am
Location: Mexico
Contact:

Re: Development Kit API problems with DSGetProjectInfo

Post by jmzl666 »

Ok, i no longer get the system.NullReferenceException, i changed the DSGetProjectInfo declaration to
[DllImport("vmdsapi.dll")] internal static extern int DSGetProjectInfo(IntPtr Project, int InfoType,[InAttribute(),OutAttribute()]ref IntPtr ProjectInfo);
Check the ref keyword, now the problem is that the pointer has a value of 2 from the function, and when i tried to use Marshal.PtrToStructure i get another exception, thanks.
jmzl666
Participant
Posts: 3
Joined: Wed Sep 20, 2006 9:36 am
Location: Mexico
Contact:

Re: Development Kit API problems with DSGetProjectInfo

Post by jmzl666 »

Problem Solved, thanks for your help.
Post Reply