Page 1 of 1

ProcedureDLLs or CDLLs and Datasections

Posted: Wed Nov 26, 2014 4:27 pm
by Duffer123
Is it possible to place a Datasection (from which say a binary file could be read) within a ProcedureDLL/CDLL?

Re: ProcedureDLLs or CDLLs and Datasections

Posted: Wed Nov 26, 2014 4:30 pm
by Tenaja
Datasections are relocated to the end of the file.

Re: ProcedureDLLs or CDLLs and Datasections

Posted: Wed Nov 26, 2014 4:35 pm
by Duffer123
@ Tenaja,

Thanks for the speedy response - so could you run through what would happen if I put a datasection in a procedureDLL
and within that say included binary file a$ (where a$ was a filename fed in as a parameter to the procedureDLL)???

Re: ProcedureDLLs or CDLLs and Datasections

Posted: Wed Nov 26, 2014 4:41 pm
by Tenaja
That binary file would be added to the end of the file, not within the proc. All data is relocated. Even if you have a dozen datasections scattered throughout, they are all placed adjacent to each other at the end.

This thread tells you how to view the asm output:
http://purebasic.fr/english/viewtopic.p ... sm#p367475

The asm has your pb code in the comments, and if you search for the datasection label, you'll find your binary.

Re: ProcedureDLLs or CDLLs and Datasections

Posted: Wed Nov 26, 2014 4:42 pm
by Tenaja
Now, if your binary file is code, you could always gosub the datasection label, just make sure to add in the hex code for a return if the binary file does not already have it. (Most likely with a CompilerIf for x86 and x64)

Re: ProcedureDLLs or CDLLs and Datasections

Posted: Wed Nov 26, 2014 4:44 pm
by Duffer123
Once again, thanks Tenaja