Raised This Month: $ Target: $400
 0% 

Compile from memory


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
ajr1234
Senior Member
Join Date: Mar 2011
Location: Chicago, IL, U.S.A.
Old 09-03-2012 , 11:41   Compile from memory
Reply With Quote #1

If I have a pawn script stored as a string in memory, would it be possible to compile and load that script? I was looking at g_pSM->GetScriptingEngine()->LoadFromFilePointer and LoadFromMemory, but there's no documentation for them (and they are deprecated), not to mention the compilation part.

Last edited by ajr1234; 09-03-2012 at 12:00.
ajr1234 is offline
asherkin
SourceMod Developer
Join Date: Aug 2009
Location: OnGameFrame()
Old 09-03-2012 , 12:13   Re: Compile from memory
Reply With Quote #2

I think this needs to be stepped back a bit, you've gone too far with no direction.

What is your actual, high-level, goal here?

Quote:
Originally Posted by http://www.catb.org/esr/faqs/smart-questions.html#goal
If you are trying to find out how to do something (as opposed to reporting a bug), begin by describing the goal. Only then describe the particular step towards it that you are blocked on.

Often, people who need technical help have a high-level goal in mind and get stuck on what they think is one particular path towards the goal. They come for help with the step, but don't realize that the path is wrong. It can take substantial effort to get past this.
__________________

Last edited by asherkin; 09-03-2012 at 12:15.
asherkin is offline
Zephyrus
Cool Pig B)
Join Date: Jun 2010
Location: Hungary
Old 09-03-2012 , 12:57   Re: Compile from memory
Reply With Quote #3

Quote:
Originally Posted by asherkin View Post
I think this needs to be stepped back a bit, you've gone too far with no direction.

What is your actual, high-level, goal here?
first thing that came to my mind:
probably wants to download an sp on-the-fly and compile it on-the-fly to workaround sharing code or something

not accusing anyone with anything so apologize me if you had no intentions to do such
__________________
Taking private C++/PHP/SourcePawn requests, PM me.
Zephyrus is offline
ajr1234
Senior Member
Join Date: Mar 2011
Location: Chicago, IL, U.S.A.
Old 09-03-2012 , 15:57   Re: Compile from memory
Reply With Quote #4

Basically I am trying to design a Visual Studio extension for pawn scripting, with breakpoints, debugger functionality, etc. I've gotten somewhat far with it, but I'm losing motivation at the same time. So far I've got "real-time" compilation (works terribly), code completion, and project solution tree working (for any plugin with code spread out over multiple includes) with Berni's SMLib tossed somewhere in there. Hitting compile will automatically compile the plugin and drop it into sourcemod's plugin folder and start the game with -insecure enabled with the debugger attached to the process.

I was trying to understand how the JIT works, how it manages memory, etc. but its complexity is beyond me, so I figured I would write an extension instead and see if I can simulate some things by modifying the plugin and recompiling on the fly.

Edit: I figured it out. I compiled the plugin on a separate thread and put the main thread to sleep only when needed.

Last edited by ajr1234; 09-03-2012 at 23:13.
ajr1234 is offline
BAILOPAN
Join Date: Jan 2004
Old 09-04-2012 , 18:50   Re: Compile from memory
Reply With Quote #5

Quote:
Originally Posted by ajr1234 View Post
Basically I am trying to design a Visual Studio extension for pawn scripting, with breakpoints, debugger functionality, etc.
Cool!

Quote:
Originally Posted by ajr1234 View Post
I was trying to understand how the JIT works, how it manages memory, etc. but its complexity is beyond me, so I figured I would write an extension instead and see if I can simulate some things by modifying the plugin and recompiling on the fly.
The SP1 API does not provide any live debugging functionality. In theory it could be possible by modifying the JIT to (1) implement the debug-break functionality (not too hard) and (2) provide a reasonable API for inspecting the stack (harder, but possible).

I don't quite understand the route you're going but it sounds difficult.

SP2 development is in progress and though I don't have any immediate plans for live debugging, I would like to expose a reasonable API for it. It's good to know where SP1 lacks.
__________________
egg
BAILOPAN is offline
ajr1234
Senior Member
Join Date: Mar 2011
Location: Chicago, IL, U.S.A.
Old 09-07-2012 , 11:15   Re: Compile from memory
Reply With Quote #6

That sounds great! I'll look forward to SP2.
ajr1234 is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 16:13.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode