callback function

  • Thread starter Thread starter Ralph Heger
  • Start date Start date
R

Ralph Heger

Hi

I want to use some functions from a C++-Library. I have to problems with
this:

1. I must not use the function-names as declared ('SoThis'), but with some
strange letters around
('?DoThisAEC@@YA?AW4S_RESULT@@QAX_N@Z).

2. The Lib wants to communicate through a callback-function. This works, my
function is called, but AFTER the 'end sub' my application crashes with a
windows-exception. Must be the moment where it jumps back to the library.

Any ideas with that?

Ralph
 
Hi

I want to use some functions from a C++-Library. I have to problems with
this:

1. I must not use the function-names as declared ('SoThis'), but with some
strange letters around
('?DoThisAEC@@YA?AW4S_RESULT@@QAX_N@Z).

This caused because the author of the dll didn't export the functions
with friendly names. Your seeing the result of name mangling. You can
always alias the call in your declare so that you don't have to litter
your code with it :)
2. The Lib wants to communicate through a callback-function. This works, my
function is called, but AFTER the 'end sub' my application crashes with a
windows-exception. Must be the moment where it jumps back to the library.

Any ideas with that?

Maybe they dll is using the cdecl calling convention. You might change
your declare to use that method. See if it makes a difference.
 
Tom Shelton said:
Maybe they dll is using the cdecl calling convention. You might change
your declare to use that method. See if it makes a difference.

I found that with the <DLLImport>Attribute, which I use for declaring the
functions in the library for my application (no cdecl is needed), but not
with a function I have to write and which has to be called by the dll. Is
there something similar?

Ralph
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top