View Single Post
  #1 (permalink)  
Old July 9th, 2003, 07:06 AM
aolden aolden is offline
Registered User
 
Join Date: Jul 2003
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Char Error In Code - Compiling but strange results

Hi All,

I'm writing a DLL that will store (from VB) a machine name then share that between other methods in the DLL - but i've run into a problem in that I can share int types but the machine name is a problem - when i try to retrieve a set value i get a series of char such as /?> and if i try again I get , - this is consistent regardless of the data i send. If I set the machine name in the declarion or within the method (SET_CORBA_SERVER) It Works - but not if i store it then call it from another procedure (Ints work all the time).

Any suggestions people can make will be more than welcome - it's one of those silly little problems.

The code for the DLL is:

#include "stdafx.h"
#include "string.h"

char *CORBASERVERNAME;
char *CORBAPORTNUMBER;
int testdata;

BOOL APIENTRY DllMain( HANDLE hModule,
                       DWORD ul_reason_for_call,
                       LPVOID lpReserved
                     )
{
    return TRUE;
}

int _stdcall GET_SECONDS_FROM_SERVER(int serverSensorID)
{
return testdata;
}

int _stdcall SET_SECONDS_ON_SERVER(int serverSensorID , int updatedSecondsLevel )
{
    testdata = updatedSecondsLevel;
}

int _stdcall SET_CORBA_SERVER(char *newPort)
{
    CORBASERVERNAME = newPort;
}

char* GET_CORBA_SERVER()
{
    return CORBASERVERNAME;
}


Reply With Quote