Im having this exception when i use the class vector:

vector <int64> p;
dsdriver::EngineAdmin ea;
p= ea.getEngineIds();

And EngineAdmin is:

class DSUTIL_EXPORT EngineAdmin {
public:
static vector<int64> getEngineIds() ;

When i use p=ea.getengineIds(); its throw me an exception in xmemory:

void deallocate(pointer _Ptr, size_type)
		{	// deallocate object at _Ptr, ignore size
		::operator delete(_Ptr);
		}

I have NO IDEA whats is happening, somebody could help me? If you want more info, i would love to give it..

Would it be possible for you to post the code for your class declaration, the function for getEngineIds(), and your main?

// Copyright 2007 DataSynapse. All Rights Reserved.

#ifndef _ENGINE_ADMIN_
#define _ENGINE_ADMIN_

#include <DSDefs.h>
#include <admin/AccessException.h>
#include <admin/NoServiceException.h>
#include <admin/EngineInfo.h>
#include <string>
#include <vector>

namespace dsdriver {
/** \file */
/** \addtogroup admin */
/** \ingroup admin */
/** \class EngineAdmin
 * Provides methods to manage Engines. Note that use of admin classes is limited according to a user’s Access Level, which is a tiered security level assigned to each GridServer user’s account.  See the GridServer Developer's Guide for more details.

 */

using std::string;
using std::vector;

static 

class DSUTIL_EXPORT EngineAdmin {
public:

    /**
     * Retrieve whether the methods are available. True on a Broker, false otherwise.
     * @return whether the service is available.
     * @throws AdminException on error
     */
    static bool isAvailable() ;

    /**
     * Retrieve the total number of Engines logged into the Broker.
     * @return total number of Engines.
     * @throws NoServiceException If the service is not available
     * @throws AccessException If the user does not have access to the operation
     * @throws AdminException on error
     */
    static int getEngineCount() ;

    /**
     * Retrieve the total number of Engines logged into the Broker that are currently processing a Task.
     * @return total number of busy Engines.
     * @throws NoServiceException If the service is not available
     * @throws AccessException If the user does not have access to the operation
     * @throws AdminException on error
     */
    static int getBusyEngineCount() ;


    /**
     * Retrieve the list of Engine IDs logged into the Broker.
     * @return the Engine ID list
     * @throws NoServiceException If the service is not available
     * @throws AccessException If the user does not have access to the operation
     * @throws AdminException on error
     */
    static vector<int64> getEngineIds() ;

    /**
     * Retrieves information on the given Engines logged into the Broker.  This
     * includes all instances for the given IDs.
     * @param engineIds the array of Engine IDs to fetch
     * @return Engine information for all instances with the given IDs.
     * @throws NoServiceException If the service is not available
     * @throws AccessException If the user does not have access to the operation
     * @throws AdminException on error
     */
    static vector<EngineInfo> getSelectedEngineInfo(const vector<int64> &engineIds) ;

    /**
     * Retrieves information on the given Engine.
     * @param id the Engine ID
     * @param instance the Engine instance
     * @return Engine information.
     * @throws NoServiceException If the service is not available
     * @throws AccessException If the user does not have access to the operation
     * @throws AdminException on error
     */
    static EngineInfo getEngineInfo(int64 id, const string &instance) ;

    /**
     * Retrieves information on the all Engines logged into the Broker.
     * @return all Engine information.
     * @throws NoServiceException If the service is not available
     * @throws AccessException If the user does not have access to the operation
     * @throws AdminException on error
     */
    static vector<EngineInfo> getAllEngineInfo() ;

    /**
     * Log out the given Engine from the Broker.
     * @param id the Engine ID
     * @param instance the Engine instance
     * @throws NoServiceException If the service is not available
     * @throws AccessException If the user does not have access to the operation
     * @throws AdminException on error
     */
    static void killEngine(int64 id, const string &instance) ;

    /**
     * Log out all the Engines from the Broker.
     * @throws NoServiceException If the service is not available
     * @throws AccessException If the user does not have access to the operation
     * @throws AdminException on error
     */
    static void killAllEngines() ;

    /**
     * Retrieves the log file URL's on the given Engine.  Engine logging must be enabled on the Manager.
     * @param id the Engine ID
     * @param instance the Engine instance
     * @return array of log URLs.
     * @throws NoServiceException If the service is not available
     * @throws AccessException If the user does not have access to the operation
     * @throws AdminException on error
     */
    static vector<string> getLogUrlList(int64 id, const string &instance) ;
};

}

#endif
// DSContadores.cpp: archivo de proyecto principal.

#include "stdafx.h"
#include "client/ServiceFactory.h"
#include "client/ServiceInvocationHandler.h"
#include <iostream>
#include <stdio.h>
#include <windows.h>
#include "admin/EngineAdmin.h"
#include "admin/ManagerAdmin.h"
#include "util/UtilFactory.h"
#include "admin/BrokerAdmin.h"
#include "admin/BrokerInfo.h"
#include "admin/EngineDaemonAdmin.h"
#include "admin/ServiceAdmin.h"
#include "driver/DriverManager.h"
#include "admin/Property.h"

using namespace System;
using namespace System::Collections;
using namespace System::Collections::Specialized;
using namespace System::Diagnostics;

using namespace std;
using namespace dsdriver;


int main(array<System::String ^> ^args)
{
vector <int64> p;
dsdriver::EngineAdmin ea;
p= ea.getEngineIds();
}

I looked at your code and the only thing that I think would be making a problem for you is the fact that you declared the method as static, but you're instantiating it, and then calling the method from the instances, which is legal, but you might try it calling it statically.

dsdriver::EngineAdmin::getEngineIds();

Also, made some REALLY simple code to see if it was the vector class that was causing your problems.

#include <iostream>
#include <vector>

class EngineAdmin {
	public:
		static std::vector<int> getEngineIds();
};

std::vector<int> EngineAdmin::getEngineIds()
{
	std::vector<int> Avector;
	
	Avector.push_back( 14 );
	Avector.push_back( 13 );

	return( Avector );

}

int main()
{
	std::vector<int> p;
	p = EngineAdmin::getEngineIds();

	return( 0 );
}

That works just fine and doesn't cause any errors.

I know debugging is difficult, and it's even more frustrating breaking down your code into bite size chunks and working up from there, but a lot of times that's the only way you can find problems.

Trying the following to see if it works, and then building up from there.

1) See if the code sample that I posted runs properly
2) If it does do the includes that you need for int64 and int64 ONLY and see if it works
3) After that put the class in the dsdriver namespace and see if it still works
4) keep building upon everything, making sure that you keep it simple and work your way up step by step

There are also times when when .net doesn't like to play friendly with stl classes, so you might want to consider that too.

I really appreciate your help, im keeping working on that:

This WORKS:

#include <vector>
#include "stdafx.h"
#include "client/ServiceFactory.h"
#include "client/ServiceInvocationHandler.h"
#include "admin/EngineAdmin.h"
#include "admin/ManagerAdmin.h"
#include "util/UtilFactory.h"
#include "admin/BrokerAdmin.h"
#include "admin/BrokerInfo.h"
#include "admin/EngineDaemonAdmin.h"
#include "admin/ServiceAdmin.h"
#include "driver/DriverManager.h"
#include "admin/Property.h"

using namespace std;
using namespace dsdriver;
 
std::vector<int64> EngineAdmin::getEngineIds()
{
	std::vector<int64> Avector;
 
	Avector.push_back( 14 );
 
	return( Avector );
 
};
 
int main()
{
	while (true) {
	try {
	dsdriver::DriverManager::connect();
	std::vector<int64> p;
	p = dsdriver::EngineAdmin::getEngineIds();
	cout << p.size() << endl;
	} catch (...) {}}
	return( 0 );
}

And this, doesnt work:

#include <vector>
#include "stdafx.h"
#include "client/ServiceFactory.h"
#include "client/ServiceInvocationHandler.h"
#include "admin/EngineAdmin.h"
#include "admin/ManagerAdmin.h"
#include "util/UtilFactory.h"
#include "admin/BrokerAdmin.h"
#include "admin/BrokerInfo.h"
#include "admin/EngineDaemonAdmin.h"
#include "admin/ServiceAdmin.h"
#include "driver/DriverManager.h"
#include "admin/Property.h"

using namespace std;
using namespace dsdriver;
 
int main()
{
	while (true) {
	try {
	dsdriver::DriverManager::connect();
	std::vector<int64> p;
	p = dsdriver::EngineAdmin::getEngineIds();
	cout << p.size() << endl;
	} catch (...) {}}
	return( 0 );
}

The difference between the first example, and the second example is this

std::vector<int64> EngineAdmin::getEngineIds()
{
	std::vector<int64> Avector;
 
	Avector.push_back( 14 );
 
	return( Avector );
 
};

is missing.

You can't use a user function without defining it, even if it's prototyped before hand. Without defining the function the computer doesn't know what to do when the function is called.

Just a side note, when you post code please put your code between

tags. It makes it easier to read.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.