March 29, 2024, 12:25:51 AM

News:

Own IWBasic 2.x ? -----> Get your free upgrade to 3.x now.........


Access violation in acparse.exe

Started by Mike Stefanik, January 13, 2006, 03:39:21 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Mike Stefanik

This (incorrect) code will cause acparse.exe to throw an access violation and die instead of reporting the error:


global sub NullBug(),string
{
return null;
}

global sub main()
{
writeln("Ouch!\n");
}


It looks like the parser doesn't like "null" being passed as a return value there.
Mike Stefanik
www.catalyst.com
Catalyst Development Corporation

Ionic Wind Support Team

Ionic Wind Support Team

Zen

Ive just had a crash too. Here's the code...


declare extern mysql_init(MYSQL *MySQL),MYSQL;

MySQL :: MySQL() {

initialized = false;

object = mysql_init(null); /* Removing This Line Stops The Crash */

// if(object <> null) {

// initialized = true;

// }

return;

}

Parker

Declaring it as a string pointer will allow you to pass null, maybe that's why I was wanting the dereferencing to work.

Zen


Parker

I mean on the line that says mysql_init. You should declare it as
declare import/extern(??) mysql_init(string *param),return_type;
of course that won't compile since you have to know the return_type and whether it uses import or extern.

Zen

look at the code i posted above i have got this...

declare extern mysql_init(MYSQL *MySQL),MYSQL;


Is that not what you mean?

Lewis

Parker

Oh oops, I didn't see that :-[

What is object declared as? If it's a MYSQL* then make the function return POINTER, since typed pointer returns are not supported, and not needed.

Zen

no its not a pointer to MYSQL, just returns a MYSQL structure.

Lewis

Zen

Ok. I sorted my problem. it was because i had created an empty structure. I just made it until i had the externals done for the MySQL library. Even still it is crashing the parser rather than returning an error.

Lewis

Ionic Wind Support Team

I think what parker is saying is Aurora can return structures from functions as it uses heap memory to do so, most other languages can't, including C. 

declare extern mysql_init(MYSQL *MySQL),MYSQL;

Would be wrong since Aurora is expecting the function to return a MYSQL structure from the external function, unless of course mysql_init is your own.  If your using a third party DLL then it should also be an "import" not an "extern".

If it is a third party library check the header carefully for #typdef's to see what MYSQL resolves to.

Paul.
Ionic Wind Support Team

Zen

yes its a static library. Ive checked the headers and MYSQL is just a structure.

Lewis

Ionic Wind Support Team

And the original function definition?
Ionic Wind Support Team

Zen

From the MySQL Manual it says...

MYSQL *mysql_init(MYSQL *mysql)


So i guess it actualy returns a pointer to that structure. I am having linking to the static library function at compile time also. Its say unresolved extern but i have the library in the libs directory and am using the #use statement.

Any ideas on that one?

Lewis

Parker

I would say
declare cdecl extern mysql_init(MYSQL* mysql),pointer;

Anyone know what the argument I can use with ar to get the globals of a library? This one is giving us lots of problems.

Parker

Nevermind, we found it. The nm tool is used to list symbols in case anyone's interested.