Jump to content
  • Advertisement
Sign in to follow this  
chaoslion

Delphi bind to AS Error

This topic is 3485 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I tried to implement Angelscript in Delphi. Therefore i wrote this struct-equivalent of asSMessageInfo:

type

 pasSMessageInfo = ^asSMessageInfo;
  asSMessageInfo = packed record
    sec: pchar;
    row: integer;
    col: integer;
    kind: integer;
    msg: pchar;
  end;

asEngine_SetMessageCallback(angel_engine,@AngelScriptMessageCB,nil,asCALL_CDECL); with
 
procedure AngelScriptMessageCB( const mi: pasSMessageInfo; p: pointer );cdecl;
begin
  Writeln(format('AS:%s<%s>(%d,%d)\n',[mi^.msg,mi^.sec,mi^.row,mi^.col]));
end;

but the output just shows eg AS:??????????<?????????????>(0,0) Did i do anything wrong while converting the asSMessageInfo struct?

Share this post


Link to post
Share on other sites
Advertisement
I'm not familiar with Delphi but it looks like you've declared everything correctly.

It may be a difference in size on the pchar versus const char * types.

Does const mi: a pointer to the message information structure?

If this doesn't work, then perhaps you can write a simple wrapper callback in C++ that translates the asSMessageInfo structure to separate parameters that Delphi understands.

Regards,
Andreas

Share this post


Link to post
Share on other sites
Set a breakpoint on that line and run it. Then check the value's of mi^.msg and mi^.sec. Also check whether "mi" points to correct data. What version of delphi do you use?

If you need further help, i'd suggest you to register at www.pascalgamedevelopment.com. You'll find more pascal/delphi programmers there that can help you out. :)

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!