PDA

View Full Version : How to include a .DLL?



picmilan
- 19th June 2016, 23:23
Hello all,

I would like to encrypt part of my code by turning it to a .DLL.

I am trying to turn part of my code to assembly and trun that to a DLL.

Now I am a bit confused on how to include a DLL in Basic code? Should I use EASYHID and C++? Would appreciate simple instruction.

BTW I am using PIC18F.

pedja089
- 20th June 2016, 15:58
There is no easy way to include Dynamic-link library, it could be done, but...
There is easy way to include static-link library. Just look up for my bootloader posts, and explanation how to pass variables between main app and bootloader.

picmilan
- 21st June 2016, 04:29
There is no easy way to include Dynamic-link library, it could be done, but... There is easy way to include static-link library. Just look up for my bootloader posts, and explanation how to pass variables between main app and bootloader. Seems like there are lots of bootloader posts that you are involved.But I think bootloader is the way to go. Is there any example for reading data/including code from bootloader to main code?

pedja089
- 21st June 2016, 08:41
There is. I can't remember topic name. In that topic I explained how variables can be shared between main app and bootloader.

pedja089
- 21st June 2016, 08:44
Found it.
http://www.picbasic.co.uk/forum/showthread.php?t=21100

pedja089
- 21st June 2016, 11:04
Can I ask you what you are trying to accomplish?

towlerg
- 21st June 2016, 14:54
ditto the last post. Why would you want to include pre-compiled code when its so much easier to include the source and compile the whole thing.

DLL's are commonly used to implement third party functions. The operating system controls initialization and there is a mutually understood way of defining and passing parameters. Non of these thing apply in this case.

I'm sure it's possible but the real question is why?

picmilan
- 21st June 2016, 20:43
The purpose is to have an open source code that part of it is encrypted. So I don't want to release part of it.Either using an object file,DLL, or code in bootloader and then call it from main code.

towlerg
- 22nd June 2016, 03:42
If you don't want to provide the source, how can it be open source?

picmilan
- 22nd June 2016, 04:20
If you don't want to provide the source, how can it be open source? Most of it will be open source but I don't want to open source small part of it dealing with USB.So basically I want to release the source code but not one of include files.

pedja089
- 22nd June 2016, 11:55
Forget about that...
First you can easily dissemble hex file, and get that ASM code. Second, how PIC will execute commands if they are encrypted. Any way you must write original source code to FLASH if you want to execute it.
So even if code is loaded in flash encrypted, and then decrypt in pic and wrote to FLASH again, just run your code in some simulator, and look FLASH content...
I don't want to be rude, but open source with hidden source is plain stupid...

towlerg
- 22nd June 2016, 15:54
I don't want to be rude either but pedja089 realy does have a point. It's either open sorce or its not (like being a little bit dead)

picmilan
- 22nd June 2016, 21:22
I don't mind if they dissemble the hex.I just don't want it to be too easy to simply read the code.As far as I can call a function in Bootloader then I am fine.I am a bit new to bootloader but can I upload two hex files to MCU? or second hex should be done through bootloader?

pedja089
- 22nd June 2016, 22:19
There is some programmers that would you probably allow you to load two hex...
I always put precompiled bootloader at end of main app and every thing i need for production is in one HEX.

technotronix
- 7th September 2016, 10:35
You can create C++ app that references the DLL file.