Newsgroups : Borland : borland.public.delphi.nativeapi.win32 : 2006 Jul : Access Violation in NTDLL.DLL .... trying to work with a C DLL.

www.cryer.info
Managed Newsgroup Archive

Access Violation in NTDLL.DLL .... trying to work with a C DLL.

Subject:Access Violation in NTDLL.DLL .... trying to work with a C DLL.
Posted by:"MFS" (silveira...@gmail.com)
Date:Fri, 7 Jul 2006 02:53:13

Hello ...

I am trying to use the function "escreve"  in a DLL written in C, in my
application. I tried to use FILE, FILE OF CHAR, TEXT, ... but error always
occurs the same: Access Violation at address 7c918fea in module ntdll.dll
write of address 00000010. In function "escreve", it has a parameter of the
type  pointer of File of  C language ----> "void DLL_EXPORT escreve(FILE
*debug_port)"


How I can call function "escreve" in delphi?
Exists some problem with threads?


Thanks!!!


The code of C dll bellow, build in Mingw.

#include <windows.h>
#include <stdio.h>
#ifdef BUILD_DLL
    #define DLL_EXPORT __declspec(dllexport)
#else
    #define DLL_EXPORT
#endif

// a sample exported function
void DLL_EXPORT escreve(FILE *debug_port)
{
    fprintf(debug_port,"aaa bbb cccc ddd eeee ffff");
}

BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
{
    switch (fdwReason)
    {
        case DLL_PROCESS_ATTACH:     break;

        case DLL_PROCESS_DETACH:    break;

        case DLL_THREAD_ATTACH:     break;

        case DLL_THREAD_DETACH:     break;
    }
    return TRUE; // succesful
}

Replies:

www.cryer.info
Managed Newsgroup Archive