NO

Author Topic: New-to-Pelles C question  (Read 3792 times)

DBell

  • Guest
New-to-Pelles C question
« on: November 09, 2015, 12:25:13 AM »
I just discovered Pelles C, and installed it (Win 7, 64 bit).

Sampling some of the sample projects, I ran across "Can't execute .dll directly ..."
But I really have no clue as to how to go about creating the code to "Now run the DLL with it's executable helper".
I see the compiler option to point to the helper executable, but how does one write it appropriately for the DLL being tested?

Dave

Offline frankie

  • Global Moderator
  • Member
  • *****
  • Posts: 2113
Re: New-to-Pelles C question
« Reply #1 on: November 09, 2015, 09:40:36 AM »
Welcome first of all.  :D
Well it should be the way around. Normally you got a bunch of routines that seems to be useful on different projects, so you decide to make a kind of collection to make them available. You have two ways: create a static library to link with the executable during building, or create a dynamic library (DLL) to be linked by the OS during the loading phase.
Following this flow it is clear than when you create a DLL you are supposed to have already your mind clear about to where to use it.
Now the 'helper executable' is a bonus that the PellesC GUI give you to help during DLL development. You can write a sample program that make use of the DLL code to check it during development. From the 'project options' dialog, in the first tab, you can specify the location for the helper executable. During DLL development if you press the 'execute' button PellesC will start helper execution in the same directory where the DLL has been created (so the OS find the library during the loading phase) and you can debug it.  ;)
"It is better to be hated for what you are than to be loved for what you are not." - Andre Gide

DBell

  • Guest
Re: New-to-Pelles C question
« Reply #2 on: November 09, 2015, 03:11:03 PM »
So, Pelles C provides a sample test Main, to call the DLL being built?
Well, that's what I most hoped for, but didn't think it was true!

Then in Compiler Option, I provide a location and name for the .exe to be created.
It appeared as if it was asking for an executable already created...

And I do understand that this is backwards to the normal way one builds and tests a library element.
But most (all?) of the samples except for Hello are structured as libs already.

Thanks!

Dave

Offline TimoVJL

  • Global Moderator
  • Member
  • *****
  • Posts: 2115
Re: New-to-Pelles C question
« Reply #3 on: November 09, 2015, 03:40:45 PM »
Example 64-bit
May the source be with you

Offline frankie

  • Global Moderator
  • Member
  • *****
  • Posts: 2113
Re: New-to-Pelles C question
« Reply #4 on: November 09, 2015, 04:49:44 PM »
So, Pelles C provides a sample test Main, to call the DLL being built?

Of course not!
You have to create the executable, then you can start debugging without jumping between DLL and executable projects.
See the sample that Timo provided.
"It is better to be hated for what you are than to be loved for what you are not." - Andre Gide