comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » CALL_EXTERNAL PROBLEM
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
CALL_EXTERNAL PROBLEM [message #38290] Mon, 01 March 2004 20:24
scuaic is currently offline  scuaic
Messages: 3
Registered: February 2004
Junior Member
Hello all.

I am trying to use call_external to call a .dll file which opens a
.txt file and read some information from it (don't ask why :) ). I am
writing my C code using Microsoft Visual C++ 6.0. My code looks like
this:

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "idl_export.h"

/* TO EXTRACT INFORMATION FROM CONTROL FILE */
extern void error(const char *); /* prints errors */

BOOL APIENTRY DllMain( HANDLE hModule,
DWORD ul_reason_for_call,
LPVOID lpReserved
)
{
return TRUE;
}

_declspec(dllexport) IDL_LONG IDL_CDECL program_control(IDL_INT *set,
IDL_INT *n)
{
/* CONTROL FILE RELATED VARIABLES */
FILE *fp1; /* FILE POINTERS */
char dest[100];
char ch;
int check = 1, i;

/* OPEN CONTROL FILE */
if ((fp1 = open("control.txt","r")) == NULL) {
error("can't open control file");
return 0;
}

/* IGNORE COMMENTS */

etc...

} /* END OF PROGRAM_CONTROL FILE */

Central to my goal is the problem of opening the 'control.txt' file
using fopen() or open(), which is not happening for some reason. The
fopen() function sometimes returns a NULL file pointer, and sometimes
a valid one. The times when it does return a valid pointer, the
variable 'fp1' just "NULLS" it somehow. I am debuging this by spawning
the IDLDE process.

I did see some posting in this regard before but didn't see any clear
solution to the problem. Perhaps it has never been discussed on this
newsgroup? Does anyone have a clue why this is happening?? Is there
something i am missing in order to open and r/w files from within a
.dll??

Along the same lines, I was also wondering how one might get the
informational messages i.e.

fprintf(stderr, "bla bla..\n");

to show up in IDL??

Any help will be greatly appreciated. Thanks.

--
Saurabh Srivastava
Graduate Research Assistant
Department of Electrical & Computer Engineering
University of Arizona
Tucson, AZ.
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Statistic codes: Significance level
Next Topic: Re: Inserting space between a 'widget_droplist' and a 'widget_button'

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Wed Oct 08 19:48:55 PDT 2025

Total time taken to generate the page: 0.00481 seconds