#include <iostream>
#include <windows.h>
#include "g.h"



typedef unsigned long (*AsmFunc)(AS_INBUF *, AS_OUTBUF *, T_REG_INF *, T_MPCNT *, ICE_ID *);


int main()
{
AsmFunc _AsmFunc;


HINSTANCE hInstLibrary = LoadLibrary((LPCWSTR)L"C:\Documents and Settings\karthikdatt\Desktop");


if (hInstLibrary)
{
_AsmFunc = (AsmFunc)GetProcAddress(hInstLibrary, "Assembler");



if (_AsmFunc)
{
std::cout << "ASSEMBLER FUNCTION" << _AsmFunc(ptr1,ptr2,ptr3,ptr4,ptr5) << std::endl;
}


}



else
{
std::cout << "DLL Failed To Load!" << std::endl;
}


FreeLibrary(hInstLibrary);



}

iam not able to load that dll file... its printing DLL Failed To Load!... so plaz anyone help me in rectifying this problem.....

Look at the string you are passing to LoadLibrary(). You are passing it the path but not the name of a library.

And you need double '\'s. "C:\\Documents ..."

Ya thanks now its going inside if (hInstLibrary) function but its not going inside this
if (_AsmFunc) loop... is there any problem in
_AsmFunc = (AsmFunc)GetProcAddress(hInstLibrary, "Assembler");

Can't say because we don't know what library is loaded or what symbols are exported from it

GetProcAddress() is returning 0 so iam not able to call the function..
what may be the possible reasons ???

The most obvious answer is, there isn't a function called "Assembler" in the DLL. Maybe there's a typo in how you built the DLL, or in what symbol-name you're expecting to find in it?

ya thanks... now its working

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.