NO

Author Topic: Acclimation Help  (Read 23628 times)

mathguy

  • Guest
Acclimation Help
« on: September 21, 2011, 06:40:10 PM »
Okay, let me preface this by saying that I am no expert and may be asking a stupid question.  For that, I'm sorry but I would really appreciate any help you can provide.

I am accustomed to and have been using Borland 4.5 IDE.  I am considering a move to Pelles and am so far quite pleased with it.  I am having problems making the transition with the following.  I have two projects.  One produces a DLL using the __stdcall convention.  The other calls and tests the DLL.  I have both projects set up in Pelles and have the DLL project compiling properly and, by all appearances, producing a valid DLL.  In the other project, testdll.exe, I am getting the following build errors:

Unresolved external symbol '_DLLNAME@16'.
POLINK: error: Unresolved external symbol '_WinMain@16'.

I have searched the forum and have found some things but none of the things I've tried have resolved the issue.  I am sure it is something quite simple but I cannot seem to figure it out.  In the Borland compiler, I used a def file to import the external.  That does not seem to work here.  I know in VS you set the imports in the options dialogs.  I don't see where I would do that in Pelles.

CommonTater

  • Guest
Re: Acclimation Help
« Reply #1 on: September 21, 2011, 06:53:59 PM »
Post your code... lets see what's going on...

Also if you are using WinMain you should go into your project settings and turn on "Enable Microsoft Extensions"
I gather your testdll program is being compiled in GUI mode....


mathguy

  • Guest
Re: Acclimation Help
« Reply #2 on: September 21, 2011, 07:53:43 PM »
Okay.  Here it is.  Some of the names have been changed to protect the innocent.  I have the Windows Extensions enabled.  Thank you for your time!

// TestEngine.cpp : Defines the entry point for the console application.
//

#include <windows.h>   
#include <stdio.h>
#include <process.h>

#include "data.h"

int far __stdcall DLL(struct buffer far *mcb,
              struct buffer2 far *mcd,
              struct buffer2 far *mce,
              struct buffer2 far *mcf);


void load_buffer(struct buffer far *mcb)
{

   data population routine

}

void test_component()
{
   struct buffer mcb;
   struct buffer2 mcd;
   struct buffer2 mce;
   struct buffer2 mcf;

   load_buffer(&mcb);
   DLL(&mcb, &mcd, &mce, &mcf);
}

int main()
{
   printf("\ntesting started\n\n");

   test_component();

   printf("\ntesting complete\n\n");
   return 0;
}



Offline TimoVJL

  • Global Moderator
  • Member
  • *****
  • Posts: 2115
Re: Acclimation Help
« Reply #3 on: September 21, 2011, 08:53:23 PM »
Quote
POLINK: error: Unresolved external symbol '_WinMain@16'
Change from menu Project -> Project options -> Linker tab -> Subsystem to Console.
Quote
Unresolved external symbol '_DLLNAME@16'.
Include your dll's import library to Library and object files.
May the source be with you

mathguy

  • Guest
Re: Acclimation Help
« Reply #4 on: September 21, 2011, 09:28:40 PM »
timo,

Thank you!  It compiles without complaint.  Now I would like to debug it and I'm getting "The program can't start because pocrt.dll is missing from your computer.  Try reinstalling the program to fix this problem."  What would be the fix for this issue?

Thanks again!!!

Offline TimoVJL

  • Global Moderator
  • Member
  • *****
  • Posts: 2115
Re: Acclimation Help
« Reply #5 on: September 21, 2011, 09:35:39 PM »
Can you compile those with static libraries ?
EDIT:
Compiler option Single threaded (LIB) or Multithreaded (LIB)
 for both projects.
« Last Edit: September 21, 2011, 10:06:09 PM by timovjl »
May the source be with you

mathguy

  • Guest
Re: Acclimation Help
« Reply #6 on: September 21, 2011, 09:43:25 PM »
Okay here's where you find out how little I know.  I'm sorry but can you help me understand what you mean by your question?

mathguy

  • Guest
Re: Acclimation Help
« Reply #7 on: September 21, 2011, 10:19:30 PM »
timo,

Okay.  I wasn't sure if that was what you meant.  I did get it to compile and run.  However, I don't think that it is making it into the DLL (where a significant amount of processing goes on).  The debugger seems to be not as robust as I would like.  Is there a way to step through code and into the library, etc.?  If so, I'm not finding it.  I like the IDE but a robust debugger is a must for what I'm working on.

Thanks for your help so far.  I really appreciate it.

Offline TimoVJL

  • Global Moderator
  • Member
  • *****
  • Posts: 2115
Re: Acclimation Help
« Reply #8 on: September 22, 2011, 07:20:22 AM »
Quote
Is there a way to step through code and into the library, etc.?
Create Project Workspace and build both projects with debug info.
Insert breakpoints into the dll project where to stop.

Quote
"The program can't start because pocrt.dll is missing from your computer.  Try reinstalling the program to fix this problem."
You can copy pocrt.dll into project folder if it isn't in the search path.
May the source be with you

CommonTater

  • Guest
Re: Acclimation Help
« Reply #9 on: September 22, 2011, 08:39:04 AM »
@mathguy... just one tiny hint here... don't use the .cpp file extension... use .c instead. 

POIDE may have trouble classifying the .cpp ones.

mathguy

  • Guest
Re: Acclimation Help
« Reply #10 on: September 22, 2011, 05:46:54 PM »
timo and Tater,

Thank you both for your help.  I've got it working the way I want to now.  I still have some things to figure out and get used to but I think that it might just be what I'm looking for.  And, you two helped prevent me from pounding my head against the wall.  I truly appreciate your help and knowledge.  Thank you!!!

CommonTater

  • Guest
Re: Acclimation Help
« Reply #11 on: September 22, 2011, 08:42:07 PM »
My pleasure!


mathguy

  • Guest
Re: Acclimation Help
« Reply #12 on: September 23, 2011, 09:35:31 PM »

Quote
"The program can't start because pocrt.dll is missing from your computer.  Try reinstalling the program to fix this problem."
You can copy pocrt.dll into project folder if it isn't in the search path.

Where can I get pocrt.dll?  I don't see that on my install.  I have pocrt64.dll but not pocrt.dll.

Offline TimoVJL

  • Global Moderator
  • Member
  • *****
  • Posts: 2115
Re: Acclimation Help
« Reply #13 on: September 23, 2011, 10:32:22 PM »
From 32-bit v.6.50 install.
May the source be with you

CommonTater

  • Guest
Re: Acclimation Help
« Reply #14 on: September 24, 2011, 01:16:47 AM »
Both should be in your PellesC\Bin folder... 

As a rule it's better to build lib based programs...

Project -> Options -> Compiler -> Runttime Library...

Either "Single-threaded (LIB)" or "Multi-threaded (LIB)" depending if you are using mutliple threads or not...

The advantage is that you don't have to distribute pocrt*.dll with your programs. 
They free stand and run without external support.