ProcedureDLLs or CDLLs and Datasections

Just starting out? Need help? Post your questions and find answers here.
Duffer123
User
User
Posts: 42
Joined: Fri Nov 30, 2012 11:40 pm

ProcedureDLLs or CDLLs and Datasections

Post by Duffer123 »

Is it possible to place a Datasection (from which say a binary file could be read) within a ProcedureDLL/CDLL?
User avatar
Tenaja
Addict
Addict
Posts: 1959
Joined: Tue Nov 09, 2010 10:15 pm

Re: ProcedureDLLs or CDLLs and Datasections

Post by Tenaja »

Datasections are relocated to the end of the file.
Duffer123
User
User
Posts: 42
Joined: Fri Nov 30, 2012 11:40 pm

Re: ProcedureDLLs or CDLLs and Datasections

Post 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)???
User avatar
Tenaja
Addict
Addict
Posts: 1959
Joined: Tue Nov 09, 2010 10:15 pm

Re: ProcedureDLLs or CDLLs and Datasections

Post 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.
User avatar
Tenaja
Addict
Addict
Posts: 1959
Joined: Tue Nov 09, 2010 10:15 pm

Re: ProcedureDLLs or CDLLs and Datasections

Post 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)
Duffer123
User
User
Posts: 42
Joined: Fri Nov 30, 2012 11:40 pm

Re: ProcedureDLLs or CDLLs and Datasections

Post by Duffer123 »

Once again, thanks Tenaja
Post Reply