- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
i am calling ISAMAX in cxml.dll from c++ dynamically loading the library well enough and finding function ok. but i am getting an err: referenced memory can't be read. here is the code:
typedef long( *p)(long, float [], long);
p ISAMAX;
HINSTANCE hLib;
hLib = LoadLibrary("C:\CXML.DLL");
ISAMAX = (p)GetProcAddress(hLib,"ISAMAX");
long n = 2;
long incx = 1;
float arr[2];
arr[0] = 1;
arr[1] = 2;
imax = ((ISAMAX)(n, arr, incx));
FreeLibrary(hLib);
I have also tried passing n and incx by reference, but no good. Does anyone have an idea as to what I am doing wrong?
typedef long( *p)(long, float [], long);
p ISAMAX;
HINSTANCE hLib;
hLib = LoadLibrary("C:\CXML.DLL");
ISAMAX = (p)GetProcAddress(hLib,"ISAMAX");
long n = 2;
long incx = 1;
float arr[2];
arr[0] = 1;
arr[1] = 2;
imax = ((ISAMAX)(n, arr, incx));
FreeLibrary(hLib);
I have also tried passing n and incx by reference, but no good. Does anyone have an idea as to what I am doing wrong?
Link Copied
2 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I note you're not checking the return statuses - CXML.DLL isn't usually in C: Also, you have to call the CXML routines with STDCALL mechanism - I don't know offhand how to express that in C++ for this case.
Steve
Steve
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
It's one of uglier aspects of C syntax (I will never remember it -- always have to do a copy&paste):
typedef long(__stdcall *p)(long*, float [], long*);Jugoslav

Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page